Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#49286 new defect (bug)

Function get_core_updates() in update-core.php can return an empty array

Reported by: citizenrepresentative Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: needs-testing needs-patch
Focuses: Cc:


The function get_core_updates() in update-core.php can return an empty array.
The problem is mostly that in core_upgrade_preamble(), the array is immediately assumed to exist, e.g.:

$updates    = get_core_updates();
if ( ! isset( $updates[0]->response ) || 'latest' == $updates[0]->response ) {

The results show up in an error:

Notice: Trying to get property 'locale' of non-object in /usr/share/wordpress/wp-admin/update-core.php on line 40
Call Stack
# Time Memory Function Location
1 0.0027 404456 {main}( ) .../update-core.php:0
2 0.1087 2873240 core_upgrade_preamble( ) .../update-core.php:695
3 0.1117 2966944 list_core_update( ) .../update-core.php:230

I believe the assumption that get_core_updates() returns a non-empty array is made in other core files as well.

A check an empty variable seems useful and non-intrusive, since this is an update check and not a critical function.

Conditions: WordPress 5.2.2, Ubunutu 19, apache, mysql packaged install with multi-site active, with the wp-content and wp-config-*.php files located in outside directories.

Change History (1)

#1 @SergeyBiryukov
21 months ago

  • Component changed from Administration to Upgrade/Install
Note: See TracTickets for help on using tickets.