I’ve just updated a project from Symfony 4.3 to 4.4. After the update when I have an error the page shown is the production error page with the “Oops! An Error Occurred!”, not the dev error page with all the trace of the error.
Also the profiler doesn’t log the error page, I can see all the requests in the profiler but no the ones with errors.
If I look at the logs (I am using docker) I can see the php errors there:
$ docker logs php 172.21.0.3 - 17/Jun/2020:09:50:53 +0000 "GET /index.php" 500 [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "NOTICE: PHP message: PHP Fatal error: Uncaught TwigErrorSyntaxError: Unexpected "}". in /app/templates/professionals/artists/list.html.twig:26" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "Stack trace:" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#0 /app/vendor/twig/twig/src/Lexer.php(292): TwigLexer->lexExpression()" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#1 /app/vendor/twig/twig/src/Lexer.php(186): TwigLexer->lexVar()" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#2 /app/vendor/twig/twig/src/Environment.php(542): TwigLexer->tokenize(Object(TwigSource))" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#3 /app/vendor/twig/twig/src/Environment.php(595): TwigEnvironment->tokenize(Object(TwigSource))" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#4 /app/vendor/twig/twig/src/Environment.php(408): TwigEnvironment->compileSource(Object(TwigSource))" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#5 /app/vendor/twig/twig/src/Environment.php(381): TwigEnvironment->loadClass('__TwigTemplate_...', 'professionals/a...', NULL)" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#6 /app/vendor/twig/twig/src/Environment.php(359): TwigEnvironment->loadTemplate('professionals/a...')" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#7 /app/vendor/symfony/twig-bridge/TwigEngine.php(135): TwigEnvironment->load('professionals/a...')" [17-Jun-2020 09:50:53] WARNING: [pool www] child 6 said into stderr: "#8 /app/vendor/symfony/twig-bridge/TwigEngine.php(54): SymfonyBridgeTwigTwigEngine->load(..."
The .env
file is set to APP_ENV=dev
Advertisement
Answer
Found the error. It was a misconfiguration with the package FosRestBundle.
I had friendsofsymfony/rest-bundle at version 2.5. I upgraded to 2.8 and in the fos_rest-yml removed the configuration “exception_controller: ‘fos_rest.exception.controller:showAction”.
After that everything worked fine again.