From 5dc3651290b0d6cad28534e6f88cc166f2e0a5b8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 6 Nov 2013 13:35:20 +0100 Subject: [ticket/12004] Support empty routes to app.php/ in path_helper The symfony routing component allows us to use the path "/" for routes. Therefore, we should be able to use example.com/app.php/ for controllers. However, this currently does not properly work. The method get_web_root_path incorrectly returns phpbb_root_path. Therefore, paths to images or files are broken. PHPBB3-12004 --- phpBB/phpbb/path_helper.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB') diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index a8e12c4063..fefef39c51 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -148,6 +148,16 @@ class path_helper // Script name URI (e.g. phpBB/app.php) $script_name = $this->symfony_request->getScriptName(); + /* + * If the path info is empty but we're using app.php, then we + * might be using an empty route like app.php/ which is + * supported by symfony's routing + */ + if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri)) + { + return $this->web_root_path = $this->phpbb_root_path . '../'; + } + /* * If the path info is empty (single /), then we're not using * a route like app.php/foo/bar -- cgit v1.2.1