1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 07:08:09 +01:00

[feature/request-class] Prevent recursive_set_var from applying htmlspecialchars twice

PHPBB3-9716
This commit is contained in:
Igor Wiedler 2010-09-19 15:31:00 +02:00
parent 204ee4714b
commit 55808e11c9
2 changed files with 22 additions and 1 deletions

View File

@ -176,7 +176,7 @@ class phpbb_request_type_cast_helper implements phpbb_request_type_cast_helper_i
$this->set_var($k, $k, $key_type, $multibyte, $multibyte);
$this->recursive_set_var($v, $default_value, $multibyte);
$this->set_var($var[$k], $v, $value_type, $multibyte);
$var[$k] = $v;
}
}
}

View File

@ -9,6 +9,7 @@
*/
require_once 'test_framework/framework.php';
require_once '../phpBB/includes/utf/utf_tools.php';
require_once '../phpBB/includes/request/type_cast_helper_interface.php';
require_once '../phpBB/includes/request/type_cast_helper.php';
@ -30,4 +31,24 @@ class phpbb_type_cast_helper_test extends phpbb_test_case
$this->assertEquals($expected, $data);
}
public function test_simple_recursive_set_var()
{
$data = 'eviL<3';
$expected = 'eviL&lt;3';
$this->type_cast_helper->recursive_set_var($data, '', true);
$this->assertEquals($expected, $data);
}
public function test_nested_recursive_set_var()
{
$data = array('eviL<3');
$expected = array('eviL&lt;3');
$this->type_cast_helper->recursive_set_var($data, array(0 => ''), true);
$this->assertEquals($expected, $data);
}
}