Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active August 29, 2015 14:17
Show Gist options
  • Save westonruter/187da1b14f0149243fd0 to your computer and use it in GitHub Desktop.
Save westonruter/187da1b14f0149243fd0 to your computer and use it in GitHub Desktop.
<?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() );
}
} );
@mauteri
Copy link

mauteri commented Mar 19, 2015

cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment