From ef410597a68ec00703176ec17d4691d81a135053 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 11 Mar 2015 16:56:34 +0100 Subject: [PATCH] [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback --- .../WebProfilerBundle/Controller/ExceptionController.php | 4 ++-- src/Symfony/Component/Debug/ExceptionHandler.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index 0b5db752ee..fd0dbecd2b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -55,7 +55,7 @@ class ExceptionController $template = $this->getTemplate(); if (!$this->twig->getLoader()->exists($template)) { - $handler = new ExceptionHandler(); + $handler = new ExceptionHandler($this->debug, $this->twig->getCharset()); return new Response($handler->getContent($exception), 200, array('Content-Type' => 'text/html')); } @@ -95,7 +95,7 @@ class ExceptionController $template = $this->getTemplate(); if (!$this->templateExists($template)) { - $handler = new ExceptionHandler(); + $handler = new ExceptionHandler($this->debug, $this->twig->getCharset()); return new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css')); } diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index f429add39e..042f3e7239 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -92,6 +92,7 @@ class ExceptionHandler foreach ($exception->getHeaders() as $name => $value) { header($name.': '.$value, false); } + header('Content-Type: text/html; charset='.$this->charset); } echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); @@ -110,7 +111,7 @@ class ExceptionHandler $exception = FlattenException::create($exception); } - return new Response($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders()); + return Response::create($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset); } /**