#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
.
Duplicate of #51073.