ibexa

Path

ez publish / technical manual / 5.x / features / override legacy fatal error...


Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

  • 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.

    Sarah Haïm-Lubczanski (10/04/2015 2:59 pm)

    Sarah Haïm-Lubczanski (22/04/2015 4:15 pm)


    Comments

    There are no comments.