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

WordPress Trac noreply at wordpress.org
Mon Aug 2 20:51:47 UTC 2021


#53002: Plugin_Upgrader's bulk_upgrade returns incorrect results when an error is
encountered
------------------------------+-----------------------------
 Reporter:  pwtyler           |       Owner:  SergeyBiryukov
     Type:  defect (bug)      |      Status:  reviewing
 Priority:  normal            |   Milestone:  5.9
Component:  Upgrade/Install   |     Version:  2.9
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * version:  5.7 => 2.9


Comment:

 Thanks for the PR! It looks good to me.

 For reference, here's what currently happens in my testing (without the
 patch):
 * `Plugin_Upgrader::bulk_upgrade()` calls `WP_Upgrader::run()`.
 * `WP_Upgrader::run()` calls `::download_package()`, `::unpack_package()`,
 and `::install_package()`.
 * `$this->result` is set in `WP_Upgrader::install_package()`, but only if
 an error has not occurred earlier.
 * If an error did occur, `$this->result` contains the result of the
 previous operation and not the current one.

 It appears to have worked this way since the initial introduction in
 [12097] / #10973, setting the version accordingly.

 With the patch, if an error occurred for one of the plugins being updated,
 a `WP_Error` object is stored, as expected.

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


More information about the wp-trac mailing list