From b7b0b0ccc3fbf92324948e8c5e616a3e06343600 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 14 May 2013 13:43:53 +0200 Subject: [ticket/11538] Make sure group color can't exceed maximum of 6 characters In order to prevent future issues with this, a basic set of functional tests for the UCP groups manage page have been added. PHPBB3-11538 --- phpBB/includes/ucp/ucp_groups.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB') diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index d62dbb1866..c1db19774a 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -597,6 +597,16 @@ class ucp_groups if (!sizeof($error)) { + // Make sure maximum length of 6 of group color is not exceeded + if (strpos($submit_ary['colour'], '#') === 0) + { + $submit_ary['colour'] = substr($submit_ary['colour'], 1, 6); + } + else + { + $submit_ary['colour'] = substr($submit_ary['colour'], 0, 6); + } + // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes // were made. -- cgit v1.2.1 From a547ba3f9d569410107574a151af9a2f301bb68e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 14 May 2013 19:44:55 +0200 Subject: [ticket/11538] Use regex for testing color value and improve tests We are now using a regex with preg_match() in order to properly check if the entered color value is in hex color format or not. A proper error message is triggered if an incorrect color value is entered and the prepended '#' is removed if necessary. PHPBB3-11538 --- phpBB/includes/ucp/ucp_groups.php | 14 +++++++++----- phpBB/language/en/common.php | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index c1db19774a..3f06e74159 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -595,18 +595,22 @@ class ucp_groups $error[] = $user->lang['FORM_INVALID']; } - if (!sizeof($error)) + if (!empty($submit_ary['colour'])) { - // Make sure maximum length of 6 of group color is not exceeded - if (strpos($submit_ary['colour'], '#') === 0) + preg_match('/^(#?)+(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/', $submit_ary['colour'], $group_colour); + + if (sizeof($group_colour)) { - $submit_ary['colour'] = substr($submit_ary['colour'], 1, 6); + $submit_ary['colour'] = (strpos($group_colour[0], '#') !== false) ? str_replace('#', '', $group_colour[0]) : $group_colour[0]; } else { - $submit_ary['colour'] = substr($submit_ary['colour'], 0, 6); + $error[] = $user->lang['COLOUR_INVALID']; } + } + if (!sizeof($error)) + { // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes // were made. diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index baf398b146..129deb551c 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -120,6 +120,7 @@ $lang = array_merge($lang, array( 'CLICK_VIEW_PRIVMSG' => '%sGo to your inbox%s', 'COLLAPSE_VIEW' => 'Collapse view', 'CLOSE_WINDOW' => 'Close window', + 'COLOUR_INVALID' => 'The colour value you entered is invalid.', 'COLOUR_SWATCH' => 'Colour swatch', 'COMMA_SEPARATOR' => ', ', // Used in pagination of ACP & prosilver, use localised comma if appropriate, eg: Ideographic or Arabic 'CONFIRM' => 'Confirm', -- cgit v1.2.1 From 1fae7720e43c8ff853225e16d0de54395d9ab051 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 14 May 2013 21:27:25 +0200 Subject: [ticket/11538] Fix incorrect regex and test for duplicate # in color string PHPBB3-11538 --- phpBB/includes/ucp/ucp_groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB') diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 3f06e74159..8ff76eac42 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -597,7 +597,7 @@ class ucp_groups if (!empty($submit_ary['colour'])) { - preg_match('/^(#?)+(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/', $submit_ary['colour'], $group_colour); + preg_match('/^#?(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/', $submit_ary['colour'], $group_colour); if (sizeof($group_colour)) { -- cgit v1.2.1 From deefe5c0e48534cea1327cf685255d109d9d7e2c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 14 May 2013 22:39:33 +0200 Subject: [ticket/11538] Simplify colour value check and remove support for '#' The input length for the hex color is now limited to 6 characters and the support for colors starting with a '#' has been dropped. The allowed input length of 7 in prosilver seems to have been a relict from old ages of phpBB3. In order to have proper support for correct checking of the colour value, the new code was also ported to the ACP groups manage page. The tests have been modified to reflect the changes to the behavior of the color check. Tests for the ACP will follow. PHPBB3-11538 --- phpBB/includes/acp/acp_groups.php | 7 +++++++ phpBB/includes/ucp/ucp_groups.php | 15 ++++----------- phpBB/language/en/common.php | 2 +- phpBB/styles/prosilver/template/ucp_groups_manage.html | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index beb7aefee5..3b0d53d52c 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -422,6 +422,13 @@ class acp_groups $error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error)); } + // 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/')))) + { + // Replace "error" string with its real, localised form + $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); + } + if (!sizeof($error)) { // Only set the rank, colour, etc. if it's changed or if we're adding a new diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 8ff76eac42..bf6af8b6f1 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -595,18 +595,11 @@ class ucp_groups $error[] = $user->lang['FORM_INVALID']; } - if (!empty($submit_ary['colour'])) + // 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/')))) { - preg_match('/^#?(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/', $submit_ary['colour'], $group_colour); - - if (sizeof($group_colour)) - { - $submit_ary['colour'] = (strpos($group_colour[0], '#') !== false) ? str_replace('#', '', $group_colour[0]) : $group_colour[0]; - } - else - { - $error[] = $user->lang['COLOUR_INVALID']; - } + // Replace "error" string with its real, localised form + $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); } if (!sizeof($error)) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 129deb551c..c986e8213d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -120,7 +120,6 @@ $lang = array_merge($lang, array( 'CLICK_VIEW_PRIVMSG' => '%sGo to your inbox%s', 'COLLAPSE_VIEW' => 'Collapse view', 'CLOSE_WINDOW' => 'Close window', - 'COLOUR_INVALID' => 'The colour value you entered is invalid.', 'COLOUR_SWATCH' => 'Colour swatch', 'COMMA_SEPARATOR' => ', ', // Used in pagination of ACP & prosilver, use localised comma if appropriate, eg: Ideographic or Arabic 'CONFIRM' => 'Confirm', @@ -723,6 +722,7 @@ $lang = array_merge($lang, array( 'WHO_IS_ONLINE' => 'Who is online', 'WRONG_PASSWORD' => 'You entered an incorrect password.', + 'WRONG_DATA_COLOUR' => 'The colour value you entered is invalid.', 'WRONG_DATA_ICQ' => 'The number you entered is not a valid ICQ number.', 'WRONG_DATA_JABBER' => 'The name you entered is not a valid Jabber account name.', 'WRONG_DATA_LANG' => 'The language you specified is not valid.', diff --git a/phpBB/styles/prosilver/template/ucp_groups_manage.html b/phpBB/styles/prosilver/template/ucp_groups_manage.html index 87b548c23b..d15cca8ee8 100644 --- a/phpBB/styles/prosilver/template/ucp_groups_manage.html +++ b/phpBB/styles/prosilver/template/ucp_groups_manage.html @@ -55,7 +55,7 @@

{L_GROUP_COLOR_EXPLAIN}
-
    [ {L_COLOUR_SWATCH} ]
+
    [ {L_COLOUR_SWATCH} ]
-- cgit v1.2.1 From 204cdb21640aead9f7560034bb8e686c17707476 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 15 May 2013 12:30:05 +0200 Subject: [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 --- phpBB/includes/acp/acp_groups.php | 2 +- phpBB/includes/ucp/ucp_groups.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 3b0d53d52c..ffbce33667 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -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)); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index bf6af8b6f1..58c8d1ae4a 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -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)); -- cgit v1.2.1 From 1715619fda2aebd7ebae960e5fcbdf4b24ce4dca Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 16 May 2013 13:22:43 +0200 Subject: [ticket/11538] Add function phpbb_validate_colour for validating colours It will be possible to use this function via the validate_data() function interface that has already been used previously. Thus, this new function will extend the capabilities of validate_data() to checking hex color values. PHPBB3-11538 --- phpBB/includes/acp/acp_groups.php | 2 +- phpBB/includes/functions_user.php | 24 +++++++++++++++++++++++- phpBB/includes/ucp/ucp_groups.php | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index ffbce33667..9a9a723605 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -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})$/')))) + if ($colour_error = validate_data($submit_ary, array('colour' => array('colour')))) { // Replace "error" string with its real, localised form $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 5a6a0b4a05..b7fdb7a6ad 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1247,8 +1247,9 @@ 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('validate_' . $function, $validate)) + if ($result = call_user_func_array($function_prefix . $function, $validate)) { // 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); @@ -1898,6 +1899,27 @@ function validate_jabber($jid) return false; } +/** +* Validate hex colour value +* +* @param string $colour The hex colour value +* @return bool/string Error message if colour value is incorrect, false if it fits the hex colour code +*/ +function phpbb_validate_colour($colour) +{ + if (empty($colour)) + { + return false; + } + + if (!preg_match('/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $colour)) + { + return 'WRONG_DATA'; + } + + return false; +} + /** * Verifies whether a style ID corresponds to an active style. * diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 58c8d1ae4a..9d2cf2728d 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -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})$/')))) + if ($colour_error = validate_data($submit_ary, array('colour' => array('colour')))) { // Replace "error" string with its real, localised form $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); -- cgit v1.2.1 From b49ce5eb3a54a6c256955d3510fe409a6f4511aa Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 19 May 2013 11:29:11 +0200 Subject: [ticket/11538] Rename phpbb_validate_colour to phpbb_validate_hex_colour PHPBB3-11538 --- phpBB/includes/acp/acp_groups.php | 2 +- phpBB/includes/functions_user.php | 5 +++-- phpBB/includes/ucp/ucp_groups.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 9a9a723605..25df9e357e 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -423,7 +423,7 @@ class acp_groups } // Validate submitted colour value - if ($colour_error = validate_data($submit_ary, array('colour' => array('colour')))) + if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour')))) { // Replace "error" string with its real, localised form $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b7fdb7a6ad..f8e1fcaa45 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1903,9 +1903,10 @@ function validate_jabber($jid) * Validate hex colour value * * @param string $colour The hex colour value -* @return bool/string Error message if colour value is incorrect, false if it fits the hex colour code +* @return bool|string Error message if colour value is incorrect, false if it +* fits the hex colour code */ -function phpbb_validate_colour($colour) +function phpbb_validate_hex_colour($colour) { if (empty($colour)) { diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 9d2cf2728d..20a55d8c32 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -596,7 +596,7 @@ class ucp_groups } // Validate submitted colour value - if ($colour_error = validate_data($submit_ary, array('colour' => array('colour')))) + if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour')))) { // Replace "error" string with its real, localised form $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); -- cgit v1.2.1 From 373e26ca746699f466e768406b951e6cf09ed284 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 19 May 2013 11:38:11 +0200 Subject: [ticket/11538] Merge calls to validate_data() in acp_groups PHPBB3-11538 --- phpBB/includes/acp/acp_groups.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 25df9e357e..bddad78bf2 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -413,20 +413,21 @@ class acp_groups } } - // Validate the length of "Maximum number of allowed recipients per private message" setting. - // We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value - // which is the lowest amongst DBMSes supported by phpBB3 - if ($max_recipients_error = validate_data($submit_ary, array('max_recipients' => array('num', false, 0, 16777215)))) - { - // Replace "error" string with its real, localised form - $error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error)); - } + /* + * Validate the length of "Maximum number of allowed recipients per private message" setting. + * We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value + * which is the lowest amongst DBMSes supported by phpBB3. + * Also validate the submitted colour value. + */ + $validation_checks = array( + 'max_recipients' => array('num', false, 0, 16777215), + 'colour' => array('hex_colour'), + ); - // Validate submitted colour value - if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour')))) + if ($validation_error = validate_data($submit_ary, $validation_checks)) { // Replace "error" string with its real, localised form - $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); + $error = array_merge($error, array_map(array(&$user, 'lang'), $validation_error)); } if (!sizeof($error)) -- cgit v1.2.1 From 7898dd945966232060bf4ff39a31b319f4962ae1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 19 May 2013 15:13:37 +0200 Subject: [ticket/11538] Limit comment in acp_groups to 80 characters per line PHPBB3-11538 --- phpBB/includes/acp/acp_groups.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index bddad78bf2..089fe4baa1 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -414,10 +414,10 @@ class acp_groups } /* - * Validate the length of "Maximum number of allowed recipients per private message" setting. - * We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value - * which is the lowest amongst DBMSes supported by phpBB3. - * Also validate the submitted colour value. + * Validate the length of "Maximum number of allowed recipients per + * private message" setting. We use 16777215 as a maximum because it matches + * MySQL unsigned mediumint maximum value which is the lowest amongst DBMSes + * supported by phpBB3. Also validate the submitted colour value. */ $validation_checks = array( 'max_recipients' => array('num', false, 0, 16777215), -- cgit v1.2.1 From cd1da92d8540d6b4aa0fa1ccf2bcafe68007288a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 19 May 2013 17:45:45 +0200 Subject: [ticket/11538] Add optional switch as argument to hex colour validation The value of $optional will decide whether an empty string will be treated as incorrect input or if it is allowed. The optional argument will default to false and therefore treat an empty string as incorrect unless explicitly told to not do so. PHPBB3-11538 --- phpBB/includes/acp/acp_groups.php | 2 +- phpBB/includes/functions_user.php | 8 +++++--- phpBB/includes/ucp/ucp_groups.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 089fe4baa1..83c355540e 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -421,7 +421,7 @@ class acp_groups */ $validation_checks = array( 'max_recipients' => array('num', false, 0, 16777215), - 'colour' => array('hex_colour'), + 'colour' => array('hex_colour', true), ); if ($validation_error = validate_data($submit_ary, $validation_checks)) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f8e1fcaa45..61972c3876 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1903,14 +1903,16 @@ function validate_jabber($jid) * Validate hex colour value * * @param string $colour The hex colour value -* @return bool|string Error message if colour value is incorrect, false if it +* @param bool $optional Whether the colour value is optional. True if an empty +* string will be accepted as correct input, false if not. +* @return bool|string Error message if colour value is incorrect, false if it * fits the hex colour code */ -function phpbb_validate_hex_colour($colour) +function phpbb_validate_hex_colour($colour, $optional = false) { if (empty($colour)) { - return false; + return (($optional) ? false : 'WRONG_DATA'); } if (!preg_match('/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $colour)) diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 20a55d8c32..9365913541 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -596,7 +596,7 @@ class ucp_groups } // Validate submitted colour value - if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour')))) + if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true)))) { // Replace "error" string with its real, localised form $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); -- cgit v1.2.1