[ticket/12097] Validate_data() should work with class method

https://tracker.phpbb.com/browse/PHPBB3-12097

PHPBB3-12097
This commit is contained in:
Nicofuma 2014-04-26 14:10:10 +02:00
parent 9eedd45aac
commit a29f3c878a

View file

@ -1326,9 +1326,18 @@ function validate_data($data, $val_ary)
{
$function = array_shift($validate);
array_unshift($validate, $data[$var]);
$function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_';
if ($result = call_user_func_array($function_prefix . $function, $validate))
if (is_array($function))
{
$result = call_user_func_array($function[0], 'validate_' . $function[1], $validate);
}
else
{
$function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_';
$result = call_user_func_array($function_prefix . $function, $validate);
}
if ($result)
{
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);