WordPress.org

Make WordPress Core

Ticket #51073: 51073.diff

File 51073.diff, 867 bytes (added by SergeyBiryukov, 6 months ago)
  • src/wp-admin/admin-header.php

     
    198198        }
    199199}
    200200
     201$error = error_get_last();
     202
    201203// Print a CSS class to make PHP errors visible.
    202 if ( error_get_last() && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' ) ) {
     204if ( $error && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
     205        // Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,
     206        // 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'] ) )
     208) {
    203209        $admin_body_class .= ' php-error';
    204210}
    205211
     212unset( $error );
     213
    206214?>
    207215</head>
    208216<?php