[WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback

This commit is contained in:
Nicolas Grekas 2015-03-11 16:56:34 +01:00
parent cbd0525f8f
commit ef410597a6
2 changed files with 4 additions and 3 deletions

View File

@ -55,7 +55,7 @@ class ExceptionController
$template = $this->getTemplate(); $template = $this->getTemplate();
if (!$this->twig->getLoader()->exists($template)) { 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')); return new Response($handler->getContent($exception), 200, array('Content-Type' => 'text/html'));
} }
@ -95,7 +95,7 @@ class ExceptionController
$template = $this->getTemplate(); $template = $this->getTemplate();
if (!$this->templateExists($template)) { 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')); return new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css'));
} }

View File

@ -92,6 +92,7 @@ class ExceptionHandler
foreach ($exception->getHeaders() as $name => $value) { foreach ($exception->getHeaders() as $name => $value) {
header($name.': '.$value, false); header($name.': '.$value, false);
} }
header('Content-Type: text/html; charset='.$this->charset);
} }
echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
@ -110,7 +111,7 @@ class ExceptionHandler
$exception = FlattenException::create($exception); $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);
} }
/** /**