Last active
August 29, 2015 14:17
-
-
Save westonruter/187da1b14f0149243fd0 to your computer and use it in GitHub Desktop.
Workaround for https://github.com/Automattic/vip-quickstart/issues/404
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Report fatal error at shutdown | |
* Author: Weston Ruter, XWP | |
* Description: Workaround for Query Monitor suppressing the displaying of errors. Workaround for <https://github.com/Automattic/vip-quickstart/issues/404> | |
* | |
* Installation instructions: | |
* $ cd vip-quickstart/www/wp-content/mu-plugins | |
* $ git clone https://gist.github.com/187da1b14f0149243fd0.git report-fatal-error-at-shutdown | |
* $ ln -s report-fatal-error-at-shutdown/report-fatal-error-at-shutdown.php . | |
*/ | |
register_shutdown_function( function () { | |
$last_error = error_get_last(); | |
if ( empty( $last_error ) || ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { | |
return; | |
} | |
if ( in_array( $last_error['type'], array( E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) { | |
print '<pre>FATAL ERROR: '; | |
print_r( error_get_last() ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool, thanks!