NGG interferes with error reporting during debugging
-
I’ve spent the last few hours trying to find out why a development WordPress installation wouldn’t display bugs despite all PHP debug flags set to true. It turned out to be the NGG plugin; after disabling the plugin, PHP errors would display normally.
After lots of debugging we found that the NextGen plugin was altering the behavior of PHP error reporting. One important line is nggallery.php:169:
set_exception_handler(__CLASS__.'::shutdown');This replaces the default exception handler globally with the NGG exception handler. This can be demonstrated by adding the following line to wp-settings.php:308:
non_existent_function().This shows a modified error report as opposed to calling the non-existent function a few lines earlier. I’ve determined this happens during loading of NGG..
After wp-settings.php:450 (do_action(‘init’)) errors do not display at all. I don’t know the exact reason for this, but the issue is resolved when disabling NextGen Gallery.
Why does NextGen Gallery decide to overwrite PHP exception handling? Why does NGG need to insert its own functionality in the error reporting? This affects a website globally.
We’re using the most recent version of WordPress (4.98) and NGG (3.0.8) with PHP 7.0.26-2+ubuntu14.04.1+deb.sury.org+2.
The topic ‘NGG interferes with error reporting during debugging’ is closed to new replies.