aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2012-11-20 16:13:29 -0500
committerDavid King <imkingdavid@gmail.com>2013-07-06 23:21:57 -0400
commitb9c290b5480a958eabeef66d5e9af799f77e4566 (patch)
treef0605df894f9bf14579c7072144d43fc44dd736c /phpBB/includes
parent0f522ddf5fb6e7d268f9d9cf428b8e3985f374ea (diff)
downloadforums-b9c290b5480a958eabeef66d5e9af799f77e4566.tar
forums-b9c290b5480a958eabeef66d5e9af799f77e4566.tar.gz
forums-b9c290b5480a958eabeef66d5e9af799f77e4566.tar.bz2
forums-b9c290b5480a958eabeef66d5e9af799f77e4566.tar.xz
forums-b9c290b5480a958eabeef66d5e9af799f77e4566.zip
[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
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 213f178694..331eaf742e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -5743,7 +5743,16 @@ function phpbb_get_web_root_path(Request $symfony_request)
}
$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 = '';
return $path;