1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 15:45:34 +02:00

[ticket/11215] Correct for different URL but same path info

When Symfony Request calculates path info, both of the following URLs give "/"
as the path info: ./app.php and ./app.php/
This commit ensures that the proper correction is made.

PHPBB3-11215
This commit is contained in:
David King 2012-11-20 16:13:29 -05:00
parent 0f522ddf5f
commit b9c290b548

View File

@ -5743,7 +5743,16 @@ function phpbb_get_web_root_path(Request $symfony_request)
} }
$path_info = $symfony_request->getPathInfo(); $path_info = $symfony_request->getPathInfo();
if ($path_info == '/')
// When no path is given (i.e. REQUEST_URI = "./app.php") path info from
// the Symfony Request object is "/". However, that is the same as when
// the REQUEST_URI is "./app.php/". So we want to correct the path when
// we have a trailing slash in the REQUEST_URI, but not when we don't.
$request_uri = $symfony_request->server->get('REQUEST_URI');
$trailing_slash = substr($request_uri, -1) === '/';
// If pathinfo is / and we do not have a trailing slash in the REQUEST_URI
if (!$trailing_slash && '/' === $path_info)
{ {
$path = ''; $path = '';
return $path; return $path;