bug #16104 Pass missing request template variables (WouterJ)

This PR was merged into the 2.8 branch.

Discussion
----------

Pass missing request template variables

Some render calls were missing the `request` variable, while it is used in the `layout.html.twig` template.

| Q | A
| --- | ---
| Fixed tickets | -
| License | MIT

Commits
-------

7f1b2c2 Pass missing request template variables
This commit is contained in:
Fabien Potencier 2015-10-05 09:20:16 +02:00
commit ef7aeaa47c

View File

@ -96,7 +96,7 @@ class ProfilerController
} }
if (!$profile = $this->profiler->loadProfile($token)) { if (!$profile = $this->profiler->loadProfile($token)) {
return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html')); return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token, 'request' => $request)), 200, array('Content-Type' => 'text/html'));
} }
if (!$profile->hasCollector($panel)) { if (!$profile->hasCollector($panel)) {
@ -140,13 +140,14 @@ class ProfilerController
/** /**
* Displays information page. * Displays information page.
* *
* @param Request $request The current HTTP Request
* @param string $about The about message * @param string $about The about message
* *
* @return Response A Response instance * @return Response A Response instance
* *
* @throws NotFoundHttpException * @throws NotFoundHttpException
*/ */
public function infoAction($about) public function infoAction(Request $request, $about)
{ {
if (null === $this->profiler) { if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.'); throw new NotFoundHttpException('The profiler must be enabled.');
@ -156,6 +157,7 @@ class ProfilerController
return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array( return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array(
'about' => $about, 'about' => $about,
'request' => $request,
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }