[wp-trac] [WordPress Trac] #50134: wp_fatal_error_handler_enabled doesn't actually do anything
WordPress Trac
noreply at wordpress.org
Fri May 8 21:10:38 UTC 2020
#50134: wp_fatal_error_handler_enabled doesn't actually do anything
--------------------------+-----------------------------
Reporter: programmin | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.4.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Suppose you want to turn off the error handling... Try this in a mu-
plugin:
{{{#!php
<?php
function somethingg() { echo 'my code runs'; return false;
}
somethingg();
add_filter( 'wp_fatal_error_handler_enabled', 'somethingg' );
}}}
And add this to error-protection.php WP:
{{{#!php
<?php
function wp_register_fatal_error_handler() {
if ( ! wp_is_fatal_error_handler_enabled() ) {
return;
}
echo 'FATAL HANDLER = TRUE';
}}}
Now if you get an error (eg new NoneClass()) you will get the output:
FATAL HANDLER = TRUEmy code runs
There has been a critical error on your website. Please check your site
admin email inbox for instructions.
So the filter apparently never is seen because the handler runs before the
add_filter even had a chance to set it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50134>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list