diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-11-03 16:24:09 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-11-03 16:24:09 +0100 |
commit | 6fd092b5df6f96530fec8ba1aec426b6d59b822b (patch) | |
tree | 750f1cafd8ace45c64256dba76a8511addca49e2 | |
parent | 6cc7da0c9c0fc8515aad780fba5de5b3860e5d56 (diff) | |
download | forums-6fd092b5df6f96530fec8ba1aec426b6d59b822b.tar forums-6fd092b5df6f96530fec8ba1aec426b6d59b822b.tar.gz forums-6fd092b5df6f96530fec8ba1aec426b6d59b822b.tar.bz2 forums-6fd092b5df6f96530fec8ba1aec426b6d59b822b.tar.xz forums-6fd092b5df6f96530fec8ba1aec426b6d59b822b.zip |
[ticket/13280] Correctly format user page for build_url()
PHPBB3-13280
-rw-r--r-- | phpBB/includes/functions.php | 3 | ||||
-rw-r--r-- | tests/functions/build_url_test.php | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1a3560dbb1..56363ed5c0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2397,7 +2397,8 @@ function build_url($strip_vars = false) global $config, $user, $phpbb_path_helper; $php_ext = $phpbb_path_helper->get_php_ext(); - $page = $user->page['page']; + // Change page back to expected format + $page = str_replace('&', '&', urldecode($user->page['page'])); // We need to be cautious here. // On some situations, the redirect path is an absolute URL, sometimes a relative path diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 06415a424e..df178f277e 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -79,9 +79,16 @@ class phpbb_build_url_test extends phpbb_test_case { global $user, $phpbb_root_path; - $user->page['page'] = $page; + $user->page['page'] = str_replace('%2F', '/', urlencode($this->sanitizer($page))); $output = build_url($strip_vars); $this->assertEquals($expected, $output); } + + protected function sanitizer($value) + { + $type_cast_helper = new \phpbb\request\type_cast_helper(); + $type_cast_helper->set_var($value, $value, gettype($value), true); + return $value; + } } |