[wp-trac] [WordPress Trac] #49286: Function get_core_updates() in update-core.php can return an empty array
WordPress Trac
noreply at wordpress.org
Fri Jan 24 15:37:36 UTC 2020
#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: Awaiting Review
Component: Administration | Version:
Severity: normal | Keywords: needs-testing needs-patch
Focuses: |
-----------------------------------+---------------------------------------
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.:
{{{#!php
$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.''
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49286>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list