diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig
index 4b9151eaf877d..58ba1fe89e466 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Resources/views/base.html.twig
@@ -1,7 +1,7 @@
-
+
{% block title %}Welcome!{% endblock %}
{% block stylesheets %}{% endblock %}
diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
index 39d4aee102b52..9f1edad12c8d1 100644
--- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
+++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
@@ -51,7 +51,7 @@ public function showAction(Request $request, FlattenException $exception, DebugL
$code = $exception->getStatusCode();
- return Response::create($this->twig->render(
+ return new Response($this->twig->render(
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $this->debug),
array(
'status_code' => $code,
@@ -60,7 +60,7 @@ public function showAction(Request $request, FlattenException $exception, DebugL
'logger' => $logger,
'currentContent' => $currentContent,
)
- ))->setCharset('UTF-8');
+ ));
}
/**
diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig
index 30b51e4760ab0..138a60ad964f1 100644
--- a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig
+++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig
@@ -1,7 +1,7 @@
-
+
An Error Occurred: {{ status_text }}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php
index 6cdb02f99deb8..20646f74aad6e 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php
@@ -39,7 +39,6 @@ public function testOnlyClearOwnOutputBuffers()
$request->headers->set('X-Php-Ob-Level', 1);
$controller = new ExceptionController($twig, false);
- $response = $controller->showAction($request, $flatten);
- $this->assertEquals('UTF-8', $response->getCharset(), 'Request charset is explicitly set to UTF-8');
+ $controller->showAction($request, $flatten);
}
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php
index abd75d440ee0a..fd0dbecd2bbec 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php
@@ -55,24 +55,23 @@ public function showAction($token)
$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'));
}
$code = $exception->getStatusCode();
- return Response::create(
- $this->twig->render($template, array(
+ return new Response($this->twig->render(
+ $template,
+ array(
'status_code' => $code,
'status_text' => Response::$statusTexts[$code],
'exception' => $exception,
'logger' => null,
'currentContent' => '',
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ )
+ ), 200, array('Content-Type' => 'text/html'));
}
/**
@@ -96,16 +95,12 @@ public function cssAction($token)
$template = $this->getTemplate();
if (!$this->templateExists($template)) {
- $handler = new ExceptionHandler();
+ $handler = new ExceptionHandler($this->debug, $this->twig->getCharset());
- $response = new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css'));
- } else {
- $response = new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, array('Content-Type' => 'text/css'));
+ return new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css'));
}
- $response->setCharset('UTF-8');
-
- return $response;
+ return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, array('Content-Type' => 'text/css'));
}
protected function getTemplate()
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
index 2c0d7a795e4d3..173616fd9f500 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
@@ -99,20 +99,16 @@ public function panelAction(Request $request, $token)
throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token));
}
- return Response::create(
- $this->twig->render($this->getTemplateManager()->getName($profile, $panel), array(
- 'token' => $token,
- 'profile' => $profile,
- 'collector' => $profile->getCollector($panel),
- 'panel' => $panel,
- 'page' => $page,
- 'request' => $request,
- 'templates' => $this->getTemplateManager()->getTemplates($profile),
- 'is_ajax' => $request->isXmlHttpRequest(),
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ return new Response($this->twig->render($this->getTemplateManager()->getName($profile, $panel), array(
+ 'token' => $token,
+ 'profile' => $profile,
+ 'collector' => $profile->getCollector($panel),
+ 'panel' => $panel,
+ 'page' => $page,
+ 'request' => $request,
+ 'templates' => $this->getTemplateManager()->getTemplates($profile),
+ 'is_ajax' => $request->isXmlHttpRequest(),
+ )), 200, array('Content-Type' => 'text/html'));
}
/**
@@ -151,13 +147,9 @@ public function infoAction($about)
$this->profiler->disable();
- return Response::create(
- $this->twig->render('@WebProfiler/Profiler/info.html.twig', array(
- 'about' => $about,
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array(
+ 'about' => $about,
+ )), 200, array('Content-Type' => 'text/html'));
}
/**
@@ -205,17 +197,13 @@ public function toolbarAction(Request $request, $token)
// the profiler is not enabled
}
- return Response::create(
- $this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
- 'position' => $position,
- 'profile' => $profile,
- 'templates' => $this->getTemplateManager()->getTemplates($profile),
- 'profiler_url' => $url,
- 'token' => $token,
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
+ 'position' => $position,
+ 'profile' => $profile,
+ 'templates' => $this->getTemplateManager()->getTemplates($profile),
+ 'profiler_url' => $url,
+ 'token' => $token,
+ )), 200, array('Content-Type' => 'text/html'));
}
/**
@@ -253,19 +241,15 @@ public function searchBarAction(Request $request)
$token = $session->get('_profiler_search_token');
}
- return Response::create(
- $this->twig->render('@WebProfiler/Profiler/search.html.twig', array(
- 'token' => $token,
- 'ip' => $ip,
- 'method' => $method,
- 'url' => $url,
- 'start' => $start,
- 'end' => $end,
- 'limit' => $limit,
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ return new Response($this->twig->render('@WebProfiler/Profiler/search.html.twig', array(
+ 'token' => $token,
+ 'ip' => $ip,
+ 'method' => $method,
+ 'url' => $url,
+ 'start' => $start,
+ 'end' => $end,
+ 'limit' => $limit,
+ )), 200, array('Content-Type' => 'text/html'));
}
/**
@@ -295,22 +279,18 @@ public function searchResultsAction(Request $request, $token)
$end = $request->query->get('end', null);
$limit = $request->query->get('limit');
- return Response::create(
- $this->twig->render('@WebProfiler/Profiler/results.html.twig', array(
- 'token' => $token,
- 'profile' => $profile,
- 'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end),
- 'ip' => $ip,
- 'method' => $method,
- 'url' => $url,
- 'start' => $start,
- 'end' => $end,
- 'limit' => $limit,
- 'panel' => null,
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ return new Response($this->twig->render('@WebProfiler/Profiler/results.html.twig', array(
+ 'token' => $token,
+ 'profile' => $profile,
+ 'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end),
+ 'ip' => $ip,
+ 'method' => $method,
+ 'url' => $url,
+ 'start' => $start,
+ 'end' => $end,
+ 'limit' => $limit,
+ 'panel' => null,
+ )), 200, array('Content-Type' => 'text/html'));
}
/**
@@ -384,7 +364,7 @@ public function phpinfoAction()
phpinfo();
$phpinfo = ob_get_clean();
- return Response::create($phpinfo, 200, array('Content-Type' => 'text/html'))->setCharset('UTF-8');
+ return new Response($phpinfo, 200, array('Content-Type' => 'text/html'));
}
/**
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
index 800f209a6ffaa..f4a84bf568730 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
@@ -68,14 +68,10 @@ public function panelAction($token)
$request = $profile->getCollector('request');
- return Response::create(
- $this->twig->render('@WebProfiler/Router/panel.html.twig', array(
- 'request' => $request,
- 'router' => $profile->getCollector('router'),
- 'traces' => $matcher->getTraces($request->getPathInfo()),
- )),
- 200,
- array('Content-Type' => 'text/html')
- )->setCharset('UTF-8');
+ return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', array(
+ 'request' => $request,
+ 'router' => $profile->getCollector('router'),
+ 'traces' => $matcher->getTraces($request->getPathInfo()),
+ )), 200, array('Content-Type' => 'text/html'));
}
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig
index e4258a205d201..3567708a72604 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig
@@ -1,8 +1,8 @@
-
-
+
+
{% block title 'Profiler' %}