mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/13280] Correctly format user page for build_url()
PHPBB3-13280
This commit is contained in:
parent
6cc7da0c9c
commit
6fd092b5df
2 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue