Question

I'm giving support to a web application based on Symfony 2.1 and previously developed by other people. My task now is trying to add customized Error Pages.

What I did was just adding the files below:

/app/Resources/TwigBundle/views/Exception/
                                   |-error404.html.twig
                                   |-error500.html.twig
                                   |-exception_full.html.twig

Having all of them the following content:

<!DOCTYPE html>
<html>   
    <body>
        <p>Errore!</p>
    </body>
</html>

The error page is showed correctly in the dev environment when, for example, the route is wrongly typed over the app_dev.php. To override the debug error page I used the exception_full template (included in the list above).

Unfortunately I don't get the same behaviour in the prod configuration when I use the url in the form

http://[..host..]/web/app.php/[..wrong route..]

Does anyone have any idea what I'm missing here? I also tried to further inspect the ExceptionController adding this:

echo "Abort!";
exit;

at the beginning of the function findTemplate(...) here:

/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php

And I could be sure that the strategy was correctly applied in dev because the response was "Abort!" as expected, but not in prod because the response was still a blank page.

For the sake of completeness, I can say that the response is correct in general when routes are correct.

Was it helpful?

Solution

I solved by myself. It seems like the problems was totally misleading because probably my local workspace was corrupted. Today I deleted my local GIT repo, I cloned again the remote GIT repo, I opened the project in Zend Studio, synced back the local project with the remote server (dev deploy), applied again the templates for custom error pages .. and everything worked as expected on the prod environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top