[wp-trac] [WordPress Trac] #53002: Plugin_Upgrader's bulk_upgrade returns incorrect results when an error is encountered

WordPress Trac noreply at wordpress.org
Thu Apr 8 19:42:00 UTC 2021


#53002: Plugin_Upgrader's bulk_upgrade returns incorrect results when an error is
encountered
-----------------------------+-----------------------------
 Reporter:  pwtyler          |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  5.7
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I initially thought this was a [https://github.com/wp-cli/extension-
 command/issues/216 WP-CLI issue] and dug in from there, but we're seeing
 that the bad results are coming from `bulk_upgrade()` in `wp-
 admin/includes/class-plugin-upgrader.php`.

 When multiple plugins are updated and one succeeds and another fails, both
 end up treated as a success (`Updated`).

 The logs printed show the expected output (error updating the second
 plugin) but the final output shows success for both updates.

 Steps to reproduce (with WP-CLI)
 {{{
 $ wp plugin install akismet --version=4.0 --force
 $ wp plugin install wordpress-importer --version=0.5 --force
 $ chmod -w wp-content/plugins/wordpress-importer
 $ wp plugin update --all
 # > See "Success: Updated 2 of 2 plugins."
 $ wp plugin list
 # > See "wordpress-importer" is still at version 0.5
 }}}

 Digging deeper, I can see the array of results created at line 350 of `wp-
 admin/includes/class-plugin-upgrader.php` is not reporting the correct
 information for the second of the two updates (the failed wordpress-
 importer update)— instead of a WP_Error Object, we're seeing a result for
 Akismet, updated previously.


 --
 Thanks to @nullvariable for the assistance tracking this down.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53002>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list