Make WordPress Core

Opened 2 weeks ago

#50763 new defect (bug)

Administration: Menu is displaced when PHP errors occur before debug mode set

Reported by: dlh Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Administration Keywords: has-screenshots
Focuses: Cc:


#35155 added support for a .php-error class in the admin that helps ensure PHP error messages remain visible once the menu renders. The class is included only when WP_DEBUG is defined, which also defines error_reporting( E_ALL ), and when error_get_last() returns an error.

If a PHP error occurs before wp_debug_mode() runs, it might go unreported if reporting isn't E_ALL. However, error_get_last() will return the error regardless, causing the .php-error class to be included, and if the error was in fact unreported, the class creates a visual gap above the menu.

Granted, wp_debug_mode() runs pretty early, but there's still room for mistakes in wp-config.php. In my case, it was a notice generated by an undefined $_SERVER key, just low enough to not be covered by the error_reporting() in wp-load.php.

To demonstrate, add to wp-config.php:

error_reporting( 0 );
trigger_error( 'oops' );

and compare after switching 0 to E_ALL.

Attachments (1)

Screen Shot 2020-07-25 at 12.34.00 AM.png (275.7 KB) - added by dlh 2 weeks ago.

Download all attachments as: .zip

Change History (1)

Note: See TracTickets for help on using tickets.