Override legacy fatal error message
The legacy Fatal Error message is : "Fatal error: The web server did not finish its request".
You can override this message without modifying the Kernel. In order to do this, you will need to create your own function, a static and public method of a Class.
To register your own function, you need to edit the error.ini file (settings/override/error.ini.append.php) adding the following lines :
[ErrorSettings-kernel] FatalErrorHandler=CustomFatalErrorHandlerClass::FatalErrorHandlerFunction
The method will be FatalErrorHandlerFunction() in a PHP Class named CustomFatalErrorHandlerClass :
<?php
class CustomFatalErrorHandlerClass
{
public static function FatalErrorHandlerFunction()
{
header("HTTP/1.1 500 Internal Server Error");
echo '<strong>Sorry!</strong> Something has gone wrong. We have logged the error but feel free to <a href="/contact">contact us</a>';
eZDisplayResult(null);
}
}Then clear the caches and regenerate the autoloads:
php bin/php/ezcache.php --clear-all --purge php bin/php/ezpgenerateautoloads.php -e -p
For more informations about this feature, you can read the Tutorial on Share.
Contributors
- Sarah Haïm-Lubczanski Updated
Comments
Add a comment