diff options
-rw-r--r-- | phpBB/includes/search/fulltext_native.php | 2 | ||||
-rw-r--r-- | phpBB/includes/startup.php | 2 | ||||
-rw-r--r-- | tests/security/trailing_path_test.php | 7 |
3 files changed, 8 insertions, 3 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 29c5a72874..948911bbfe 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -204,7 +204,7 @@ class fulltext_native extends search_backend $this->search_query = $keywords; $exact_words = array(); - preg_match_all('#([^\\s+\\-|*()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words); + preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words); $exact_words = $exact_words[1]; $common_ids = $words = array(); diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index 92639fc5bd..9bbbf4fd4c 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -105,7 +105,7 @@ function deregister_globals() function phpbb_has_trailing_path($phpEx) { // Check if path_info is being used - if (!empty($_SERVER['PATH_INFO']) || !empty($_SERVER['ORIG_PATH_INFO'])) + if (!empty($_SERVER['PATH_INFO']) || (!empty($_SERVER['ORIG_PATH_INFO']) && $_SERVER['SCRIPT_NAME'] != $_SERVER['ORIG_PATH_INFO'])) { return true; } diff --git a/tests/security/trailing_path_test.php b/tests/security/trailing_path_test.php index 72ec6b8816..9d586e74ef 100644 --- a/tests/security/trailing_path_test.php +++ b/tests/security/trailing_path_test.php @@ -36,19 +36,24 @@ class phpbb_security_trailing_path_test extends phpbb_test_case array(true, '', '', '/phpBB/index.php/?foo/a'), array(true, '', '', '/projects/php.bb/phpBB/index.php/?a=5'), array(false, '', '', '/projects/php.bb/phpBB/index.php?/a=5'), + array(false, '', '/phpBB/index.php', '/phpBB/index.php', '/phpBB/index.php'), + array(true, '', '/phpBB/index.php', '/phpBB/index.php'), + array(true, '', '/phpBB/index.php/', '/phpBB/index.php/', '/phpBB/index.php'), + array(true, '', '/phpBB/index.php/', '/phpBB/index.php/'), ); } /** * @dataProvider data_has_trailing_path */ - public function test_has_trailing_path($expected, $path_info, $orig_path_info, $request_uri) + public function test_has_trailing_path($expected, $path_info, $orig_path_info, $request_uri, $script_name = '') { global $phpEx; $_SERVER['PATH_INFO'] = $path_info; $_SERVER['ORIG_PATH_INFO'] = $orig_path_info; $_SERVER['REQUEST_URI'] = $request_uri; + $_SERVER['SCRIPT_NAME'] = $script_name; $this->assertSame($expected, phpbb_has_trailing_path($phpEx)); } |