Skip to content

Commit 3ebe036

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Updated all the README files [TwigBundle] Fix failing test on appveyor Improved the error message when using "@" in a decorated service Improve error reporting in router panel of web profiler [DoctrineBridge][Form] Fix performance regression in EntityType [FrameworkBundle] Fix a regression in handling absolute and namespaced template paths Allow to normalize \Traversable minor [Form] fix tests added by symfony#16886 Remove _path from query parameters when fragment is a subrequest and request attributes are already set Added tests for _path removal in FragmentListener Simplified everything Added a test Fixed the problem in an easier way Fixed a syntax issue Improved the error message when a template is not found [CodingStandards] Conformed to coding standards [TwigBundle] fixed Include file locations in "Template could not be found" exception
2 parents 76cfccd + 441a898 commit 3ebe036

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

Controller/RouterController.php

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Routing\RouterInterface;
1919
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2020
use Symfony\Component\HttpKernel\Profiler\Profiler;
21+
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
2122

2223
/**
2324
* RouterController.
@@ -62,16 +63,39 @@ public function panelAction($token)
6263

6364
$profile = $this->profiler->loadProfile($token);
6465

65-
$context = $this->matcher->getContext();
66-
$context->setMethod($profile->getMethod());
67-
$matcher = new TraceableUrlMatcher($this->routes, $context);
68-
66+
/** @var RequestDataCollector $request */
6967
$request = $profile->getCollector('request');
7068

7169
return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', array(
7270
'request' => $request,
7371
'router' => $profile->getCollector('router'),
74-
'traces' => $matcher->getTraces($request->getPathInfo()),
72+
'traces' => $this->getTraces($request, $profile->getMethod()),
7573
)), 200, array('Content-Type' => 'text/html'));
7674
}
75+
76+
/**
77+
* Returns the routing traces associated to the given request.
78+
*
79+
* @param RequestDataCollector $request
80+
* @param string $method
81+
*
82+
* @return array
83+
*/
84+
private function getTraces(RequestDataCollector $request, $method)
85+
{
86+
$traceRequest = Request::create(
87+
$request->getPathInfo(),
88+
$request->getRequestServer()->get('REQUEST_METHOD'),
89+
$request->getRequestAttributes()->all(),
90+
$request->getRequestCookies()->all(),
91+
array(),
92+
$request->getRequestServer()->all()
93+
);
94+
95+
$context = $this->matcher->getContext();
96+
$context->setMethod($method);
97+
$matcher = new TraceableUrlMatcher($this->routes, $context);
98+
99+
return $matcher->getTracesForRequest($traceRequest);
100+
}
77101
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy