fixed link generation when doing sub-requests
This commit is contained in:
parent
e983029ddc
commit
018c8d548c
@ -136,13 +136,14 @@ class Request
|
|||||||
'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
|
'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
|
||||||
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
|
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
|
||||||
'REMOTE_ADDR' => '127.0.0.1',
|
'REMOTE_ADDR' => '127.0.0.1',
|
||||||
|
'SCRIPT_NAME' => '',
|
||||||
|
'SCRIPT_FILENAME' => '',
|
||||||
|
), $server, array(
|
||||||
'REQUEST_METHOD' => strtoupper($method),
|
'REQUEST_METHOD' => strtoupper($method),
|
||||||
'PATH_INFO' => '',
|
'PATH_INFO' => '',
|
||||||
'REQUEST_URI' => $uri,
|
'REQUEST_URI' => $uri,
|
||||||
'SCRIPT_NAME' => '',
|
|
||||||
'SCRIPT_FILENAME' => '',
|
|
||||||
'QUERY_STRING' => $queryString,
|
'QUERY_STRING' => $queryString,
|
||||||
), $server);
|
));
|
||||||
|
|
||||||
return new self($request, $query, array(), $cookies, $files, $server);
|
return new self($request, $query, array(), $cookies, $files, $server);
|
||||||
}
|
}
|
||||||
|
@ -43,26 +43,22 @@ class RequestParser
|
|||||||
|
|
||||||
public function resolve(Event $event)
|
public function resolve(Event $event)
|
||||||
{
|
{
|
||||||
if (!$event->getParameter('main_request'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$request = $event->getParameter('request');
|
$request = $event->getParameter('request');
|
||||||
|
|
||||||
$this->container->setParameter('request.base_path', $request->getBasePath());
|
// set the context even if the parsing does not need to be done
|
||||||
|
// to have correct link generation
|
||||||
if ($request->path->get('_bundle'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->router->setContext(array(
|
$this->router->setContext(array(
|
||||||
'base_url' => $request->getBaseUrl(),
|
'base_url' => $request->getBaseUrl(),
|
||||||
'method' => $request->getMethod(),
|
'method' => $request->getMethod(),
|
||||||
'host' => $request->getHost(),
|
'host' => $request->getHost(),
|
||||||
'is_secure' => $request->isSecure(),
|
'is_secure' => $request->isSecure(),
|
||||||
));
|
));
|
||||||
|
$this->container->setParameter('request.base_path', $request->getBasePath());
|
||||||
|
|
||||||
|
if (!$event->getParameter('main_request') || $request->path->has('_bundle'))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (false !== $parameters = $this->router->match($request->getPathInfo()))
|
if (false !== $parameters = $this->router->match($request->getPathInfo()))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user