Closed
Description
I've encountered an inconsistent behavior with Request::getBaseUrl method when the Request URI does not include the SCRIPT_NAME (due for example to an apache url rewrite), but it includes a segment of the SCRIPT_NAME path.
In RequestTest.php, if I add this data to the getBaseUrlData data provider, testGetBaseUrl fails:
//Test Fails
array(
'/webmaster',
array(
'SCRIPT_FILENAME' => '/foo/bar/web/index.php',
'SCRIPT_NAME' => '/web/index.php',
'PHP_SELF' => '/web/index.php',
),
'', //getBaseUrl Fails, '/web' returned
'/webmaster', //getPathInfo Fails, 'master' returned
)
because in this case getBaseUrl returns '/web' and not ''. This make getPathInfo fails too (it returns 'master' instead of '/webmaster'),
If the URI does not start with 'web' all works as expected:
//Test passes
array(
'/administrator',
array(
'SCRIPT_FILENAME' => '/foo/bar/web/index.php',
'SCRIPT_NAME' => '/web/index.php',
'PHP_SELF' => '/web/index.php',
),
'', //getBaseUrl
'/administrator', //getPathInfo
)