[HttpFoundation] Fix baseUrl when script filename is contained in pathInfo
This commit is contained in:
parent
5d428b7091
commit
f24a6dd43a
@ -1712,7 +1712,7 @@ class Request
|
|||||||
return $prefix;
|
return $prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, dirname($baseUrl).'/')) {
|
if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(dirname($baseUrl), '/').'/')) {
|
||||||
// directory portion of $baseUrl matches
|
// directory portion of $baseUrl matches
|
||||||
return rtrim($prefix, '/');
|
return rtrim($prefix, '/');
|
||||||
}
|
}
|
||||||
|
@ -1320,6 +1320,26 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function getBaseUrlData()
|
public function getBaseUrlData()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
array(
|
||||||
|
'/fruit/strawberry/1234index.php/blah',
|
||||||
|
array(
|
||||||
|
'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php',
|
||||||
|
'SCRIPT_NAME' => '/fruit/index.php',
|
||||||
|
'PHP_SELF' => '/fruit/index.php',
|
||||||
|
),
|
||||||
|
'/fruit',
|
||||||
|
'/strawberry/1234index.php/blah',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'/fruit/strawberry/1234index.php/blah',
|
||||||
|
array(
|
||||||
|
'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php',
|
||||||
|
'SCRIPT_NAME' => '/index.php',
|
||||||
|
'PHP_SELF' => '/index.php',
|
||||||
|
),
|
||||||
|
'',
|
||||||
|
'/fruit/strawberry/1234index.php/blah',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'/foo%20bar/',
|
'/foo%20bar/',
|
||||||
array(
|
array(
|
||||||
|
Reference in New Issue
Block a user