From 07632d46fc730c9b487e7a550ad94d08cb72e27d Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Mon, 9 Sep 2013 20:52:29 +0300 Subject: [PATCH] [ticket/develop/11832] Fix path detection Clean up path, do not count first / PHPBB3-11832 --- phpBB/includes/functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4d2d704a43..7cc3e11129 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5733,6 +5733,8 @@ function phpbb_create_symfony_request(phpbb_request $request) */ function phpbb_get_web_root_path(Request $symfony_request, $phpbb_root_path = '') { + global $phpbb_container; + static $path; if (null !== $path) { @@ -5746,7 +5748,11 @@ function phpbb_get_web_root_path(Request $symfony_request, $phpbb_root_path = '' return $path; } - $corrections = substr_count($path_info, '/'); + $filesystem = $phpbb_container->get('filesystem'); + $path_info = $filesystem->clean_path($path_info); + + // Do not count / at start of path + $corrections = substr_count(substr($path_info, 1), '/'); // When URL Rewriting is enabled, app.php is optional. We have to // correct for it not being there