WordPress.org

Make WordPress Core

Opened 2 months ago

Closed 4 weeks ago

Last modified 4 weeks ago

#50763 closed defect (bug) (duplicate)

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

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

Description

#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 months ago.

Download all attachments as: .zip

Change History (3)

#1 @dlh
4 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #51073.

#2 @SergeyBiryukov
4 weeks ago

Ah, thanks for the report. Sorry I hadn't noticed this before #51073 :)

Note: See TracTickets for help on using tickets.