WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/07/2020 01:03:42 PM (15 months ago)
Author:
SergeyBiryukov
Message:

Administration: Give the $error variable in wp-admin/admin-header.php a more descriptive name.

This avoids a conflict with the same global variable used elsewhere, e.g. in Theme Editor.

Follow-up to [48850].

Props vinayak.anivase.
Merges [48938] to the 5.5 branch.
Fixes #51219.

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/src/wp-admin/admin-header.php

    r48851 r48955  
    199199}
    200200
    201 $error = error_get_last();
     201$error_get_last = error_get_last();
    202202
    203203// Print a CSS class to make PHP errors visible.
    204 if ( $error && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
     204if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
    205205    // Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,
    206206    // and should not be displayed with the `error_reporting` level previously set in wp-load.php.
    207     && ( E_NOTICE !== $error['type'] || 'wp-config.php' !== wp_basename( $error['file'] ) )
     207    && ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) )
    208208) {
    209209    $admin_body_class .= ' php-error';
    210210}
    211211
    212 unset( $error );
     212unset( $error_get_last );
    213213
    214214?>
Note: See TracChangeset for help on using the changeset viewer.