I have just updated my Symfony 2.7 page to 2.8. Beside Symfony itself a number of other packages (e.g. FOSUserBundle
, FOSRestBundle
, Doctrine
, etc.) have been updated as well.
After the Update my CustomExceptionController
does not work any more. Error like 404 or 500 show the default exception page instead of my custom page. Before the Update my CustomExceptionController
worked without any problem.
This is the configuration:
// app/config/config.yml
...
twig:
exception_controller: app.exception_controller:showAction
// src/MyAppBundle/Resources/config/services.yml
app.exception_controller:
class: MyAppBundle\Controller\CustomExceptionController
arguments: ['@twig', '%kernel.debug%', "@translator.default" ]
// src/MyAppBundle/Controller/CustomExceptionController.php
use Symfony\Component\Debug\Exception\FlattenException;
//use Symfony\Component\HttpKernel\Exception\FlattenException;
class CustomExceptionController extends ExceptionController {
protected $translator;
public function __construct(\Twig_Environment $twig, $debug, Translator $translator) {
parent::__construct($twig, $debug);
$this->translator = $translator;
}
public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null) {
...
}
The only change in the config of the CustomExceptionController
is using
use Symfony\Component\Debug\Exception\FlattenException
instead of
use Symfony\Component\HttpKernel\Exception\FlattenException
(which is deprecated since Symfony 2.3). However the problem is the same, also when this changed back to the ..\HttpKernel\...
class.
As far as I can tell there have been no other changes the the configuration of the CustomExceptionController
. The config is exactly the same as in the Symfony docs.
Any idea what might be wrong?