mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11538] Make sure regex doesn't allow multiple color values
This will now make sure that 'AAFF00' will be matched but strings like 'AAFF00 AABB00' will not. PHPBB3-11538
This commit is contained in:
parent
cbe4a3c3b6
commit
204cdb2164
4 changed files with 8 additions and 2 deletions
|
@ -423,7 +423,7 @@ class acp_groups
|
|||
}
|
||||
|
||||
// Validate submitted colour value
|
||||
if ($colour_error = validate_data($submit_ary, array('colour' => array('match', true, '/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/'))))
|
||||
if ($colour_error = validate_data($submit_ary, array('colour' => array('match', true, '/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/'))))
|
||||
{
|
||||
// Replace "error" string with its real, localised form
|
||||
$error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error));
|
||||
|
|
|
@ -596,7 +596,7 @@ class ucp_groups
|
|||
}
|
||||
|
||||
// Validate submitted colour value
|
||||
if ($colour_error = validate_data($submit_ary, array('colour' => array('match', true, '/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/'))))
|
||||
if ($colour_error = validate_data($submit_ary, array('colour' => array('match', true, '/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/'))))
|
||||
{
|
||||
// Replace "error" string with its real, localised form
|
||||
$error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error));
|
||||
|
|
|
@ -23,6 +23,9 @@ class phpbb_functional_acp_groups_test extends phpbb_functional_test_case
|
|||
array('a00', 'GROUP_UPDATED'),
|
||||
array('ag0', 'WRONG_DATA_COLOUR'),
|
||||
array('#aa0', 'WRONG_DATA_COLOUR'),
|
||||
array('AA0000 ', 'GROUP_UPDATED'),
|
||||
array('AA0000 abf', 'WRONG_DATA_COLOUR'),
|
||||
array('AA0000 AA0000', 'WRONG_DATA_COLOUR'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ class phpbb_functional_ucp_groups_test extends phpbb_functional_test_case
|
|||
array('a00', 'GROUP_UPDATED'),
|
||||
array('ag0', 'WRONG_DATA_COLOUR'),
|
||||
array('#aa0', 'WRONG_DATA_COLOUR'),
|
||||
array('AA0000 ', 'GROUP_UPDATED'),
|
||||
array('AA0000 abf', 'WRONG_DATA_COLOUR'),
|
||||
array('AA0000 AA0000', 'WRONG_DATA_COLOUR'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue