Make WordPress Core

Changeset 49676


Ignore:
Timestamp:
11/21/2020 02:37:44 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Site Health: Check if $core_updates is an array before iterating on it.

This avoids a PHP warning if get_core_updates() returns false.

Props paulschreiber.
Fixes #51818.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r49477 r49676  
    4949        $core_update_needed     = '';
    5050
    51         foreach ( $core_updates as $core => $update ) {
    52             if ( 'upgrade' === $update->response ) {
    53                 /* translators: %s: Latest WordPress version number. */
    54                 $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );
    55             } else {
    56                 $core_update_needed = '';
     51        if ( is_array( $core_updates ) ) {
     52            foreach ( $core_updates as $core => $update ) {
     53                if ( 'upgrade' === $update->response ) {
     54                    /* translators: %s: Latest WordPress version number. */
     55                    $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );
     56                } else {
     57                    $core_update_needed = '';
     58                }
    5759            }
    5860        }
Note: See TracChangeset for help on using the changeset viewer.