diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2016-02-11 23:40:39 +0100 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2016-02-11 23:40:39 +0100 |
| commit | 05fec8c642e00e2e6967c5043486fa232dd32db0 (patch) | |
| tree | 9e29883c4c61c7cf47048048abbc6637a646fe09 | |
| parent | c9e5d308f2ebaae5ddaa70faf25af93fe2eb368b (diff) | |
| parent | 971fe13a2893bf9ff550d2ae60de9613d56dda62 (diff) | |
| download | forums-05fec8c642e00e2e6967c5043486fa232dd32db0.tar forums-05fec8c642e00e2e6967c5043486fa232dd32db0.tar.gz forums-05fec8c642e00e2e6967c5043486fa232dd32db0.tar.bz2 forums-05fec8c642e00e2e6967c5043486fa232dd32db0.tar.xz forums-05fec8c642e00e2e6967c5043486fa232dd32db0.zip | |
Merge branch '3.2.x'
| -rw-r--r-- | phpBB/phpbb/path_helper.php | 9 | ||||
| -rw-r--r-- | tests/path_helper/path_helper_test.php | 37 |
2 files changed, 45 insertions, 1 deletions
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 7b0d6f0fba..154361ef64 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -100,11 +100,18 @@ class path_helper */ public function update_web_root_path($path) { + $web_root_path = $this->get_web_root_path(); + + // Removes the web root path if it is already present + if (strpos($path, $web_root_path) === 0) + { + $path = $this->phpbb_root_path . substr($path, strlen($web_root_path)); + } + if (strpos($path, $this->phpbb_root_path) === 0) { $path = substr($path, strlen($this->phpbb_root_path)); - $web_root_path = $this->get_web_root_path(); if (substr($web_root_path, -8) === 'app.php/' && substr($path, 0, 7) === 'app.php') { $path = substr($path, 8); diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 007441bc92..49dd40fbec 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -135,6 +135,43 @@ class phpbb_path_helper_test extends phpbb_test_case '/phpbb3-fork/phpBB/app.php', './../', ), + + // No correction if the path is already prepend by the web root path + array( + './../' . $this->phpbb_root_path . 'test.php', + '//', + null, + null, + '', + ), + array( + './../' . $this->phpbb_root_path . 'test.php', + '//', + 'foo/bar.php', + 'bar.php', + '', + ), + array( + './../../' . $this->phpbb_root_path . 'test.php', + '/foo/template', + '/phpbb3-fork/phpBB/app.php/foo/template', + '/phpbb3-fork/phpBB/app.php', + '', + ), + array( + './../' . $this->phpbb_root_path . 'test.php', + '/foo/template', + '/phpbb3-fork/phpBB/foo/template', + '/phpbb3-fork/phpBB/app.php', + '', + ), + array( + './../'.$this->phpbb_root_path . 'test.php', + '/', + '/phpbb3-fork/phpBB/app.php/', + '/phpbb3-fork/phpBB/app.php', + '', + ), ); } |
