diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index a9b520be15..f92c2b72b2 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -254,16 +254,18 @@ class path_helper foreach ($args as $argument) { - $arguments = explode('=', $argument); - $key = $arguments[0]; - unset($arguments[0]); + if (empty($argument)) + { + continue; + } + list($key, $value) = explode('=', $argument, 2); if ($key === '') { continue; } - $params[$key] = $arguments[1]; + $params[$key] = $value; } } else diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index e77ad6d343..724f26956c 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -226,6 +226,21 @@ class phpbb_path_helper_test extends phpbb_test_case true, array('base' => 'https://phpbb.com/community/viewtopic.php', 'params' => array('t' => '5', 'f' => '6')), ), + array( + 'test.php?topic=post=5&f=3', + true, + array('base' => 'test.php', 'params' => array('topic' => 'post=5', 'f' => '3')), + ), + array( + 'mcp.php?&t=4&f=3', + true, + array('base' => 'mcp.php', 'params' => array('t' => '4', 'f' => '3')), + ), + array( + 'mcp.php?=4&f=3', + true, + array('base' => 'mcp.php', 'params' => array('f' => '3')), + ), ); }