[wp-trac] [WordPress Trac] #49286: Function get_core_updates() in update-core.php can return an empty array

WordPress Trac noreply at wordpress.org
Sun Oct 16 05:56:58 UTC 2022


#49286: Function get_core_updates() in update-core.php can return an empty array
-------------------------------------+-----------------------------
 Reporter:  citizenrepresentative    |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Upgrade/Install          |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  needs-testing has-patch  |     Focuses:
-------------------------------------+-----------------------------
Changes (by costdev):

 * keywords:  needs-testing needs-patch => needs-testing has-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 I have attached a patch that returns early from `list_core_update()` if
 `$update` is not an object.

 For good measure, I've also wrapped the list output in
 `core_upgrade_preamble` in a `if ( $updates )` check so that an empty list
 is not output when `get_core_updates()` returns either `false` or
 `array()`.

 Unfortunately, I can't add PHPUnit tests for these changes without moving
 `list_core_update()` and `core_upgrade_preamble()` to a separate file due
 to headers being sent.

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


More information about the wp-trac mailing list