[wp-trac] [WordPress Trac] #50763: Administration: Menu is displaced when PHP errors occur before debug mode set
WordPress Trac
noreply at wordpress.org
Sat Jul 25 05:11:22 UTC 2020
#50763: Administration: Menu is displaced when PHP errors occur before debug mode
set
----------------------------+-----------------------------
Reporter: dlh | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Keywords: has-screenshots
Focuses: |
----------------------------+-----------------------------
#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`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50763>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list