Skip to content

Commit 35534a8

Browse files
committed
[WebProfilerBundle] [FrameworkBundle] profile forward controller action
closes #14358 The `Symfony\Bundle\FrameworkBundle\Controller\Controller::forward()` now passes request attributes to its sub request, so when the profiler will profile the sub request it will add its token to its hold by reference parent request attributes. The profiler main profiler layout displays a shortcut to the forwarded sub request profile which is actually responsible for returning the present response. The web debug toolbar shows a notifying icon, meaning a shortcut to a forwarded profile is available in the toolbar request panel.
1 parent a58c5cf commit 35534a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Controller/Controller.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ protected function generateUrl($route, $parameters = array(), $referenceType = U
6565
*/
6666
protected function forward($controller, array $path = array(), array $query = array())
6767
{
68+
$request = $this->container->get('request_stack')->getCurrentRequest();
69+
$path['_forwarded'] = $request->attributes;
6870
$path['_controller'] = $controller;
69-
$subRequest = $this->container->get('request_stack')->getCurrentRequest()->duplicate($query, null, $path);
71+
$subRequest = $request->duplicate($query, null, $path);
7072

7173
return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
7274
}

0 commit comments

Comments
 (0)