[wp-trac] [WordPress Trac] #50852: Site Health applies auto_update_theme filter incorrectly

WordPress Trac noreply at wordpress.org
Wed Aug 5 14:31:14 UTC 2020


#50852: Site Health applies auto_update_theme filter incorrectly
--------------------------+------------------------------
 Reporter:  bpayton       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Site Health   |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by bpayton):

 Here are instructions to reproduce the issue using WP-CLI. These should
 have been included in the original report.

 **Setup**

 Add the following filter in an mu-plugin to log the type of item passed to
 the filter:
 {{{#!php
 <?php
 add_filter( 'auto_update_theme',
 'reproduce_auto_update_theme_inconsistency', 10, 2 );

 function reproduce_auto_update_theme_inconsistency( $allow_update, $item )
 {
         error_log( 'auto_update_theme item type is ' . gettype( $item ) );
         return $allow_update;
 }
 }}}

 **To observe correct usage of the filter in the auto update system:**

 1. Install an old version of a theme like `wp theme install --force
 --version=1.4.6 zakra`
 2. Schedule and run theme auto updates:

 {{{
 wp cron event schedule wp_update_themes now
 wp cron event schedule wp_version_check now
 wp cron event run --due-now
 }}}

 3. Observe the following in the log output:

 ''auto_update_theme item type is object''

 **To observe the incorrect behavior by Site Health:**

 1. Navigate to the Site Health information view
 2. Observe the log output contains messages like:

 ''auto_update_theme item type is array''

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50852#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list