10000 bug #11904 Make twig ExceptionController conformed with ExceptionList… · symfony/symfony@d0537e0 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0537e0

Browse files
committed
bug #11904 Make twig ExceptionController conformed with ExceptionListener (megazoll)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #11904). Discussion ---------- Make twig ExceptionController conformed with ExceptionListener | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9083 | License | MIT | Doc PR | Parameter passed to exception controller from exception listener called ``format``, so variable ``_format`` in exception controller always takes default value. https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php#L120 Commits ------- 24c5ba4 Use request format from request in twig ExceptionController
2 parents 6ad5d31 + 24c5ba4 commit d0537e0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,19 @@ public function __construct(\Twig_Environment $twig, $debug)
3939
* @param Request $request The request
4040
* @param FlattenException $exception A FlattenException instance
4141
* @param DebugLoggerInterface $logger A DebugLoggerInterface instance
42-
* @param string $_format The format to use for rendering (html, xml, ...)
4342
*
4443
* @return Response
4544
*
4645
* @throws \InvalidArgumentException When the exception template does not exist
4746
*/
48-
public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null, $_format = 'html')
47+
public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null)
4948
{
5049
$currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1));
5150

5251
$code = $exception->getStatusCode();
5352

5453
return new Response($this->twig->render(
55-
$this->findTemplate($request, $_format, $code, $this->debug),
54+
$this->findTemplate($request, $request->getRequestFormat(), $code, $this->debug),
5655
array(
5756
'status_code' => $code,
5857
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',

0 commit comments

Comments
 (0)
0