From: kink Date: Wed, 3 May 2006 13:37:53 +0000 (+0000) Subject: Correct references trimming: array_walk can't in all PHP versions use X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=86e6a9ebfbfd6ae038384c1b723e55701b6a213f;p=squirrelmail.git Correct references trimming: array_walk can't in all PHP versions use a callback function that is a member function. Moving the function out of the class seems the best solution. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11107 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/class/deliver/Deliver.class.php b/class/deliver/Deliver.class.php index f22b5f87..824086aa 100644 --- a/class/deliver/Deliver.class.php +++ b/class/deliver/Deliver.class.php @@ -742,7 +742,7 @@ class Deliver { $aReferences[] = $message_id; // sanitize the array: trim whitespace, remove dupes - array_walk($aReferences, 'trim_value'); + array_walk($aReferences, 'sq_trim_value'); $aReferences = array_unique($aReferences); while ( count($aReferences) > 4 && strlen(implode(' ', $aReferences)) >= 986 ) { @@ -751,13 +751,6 @@ class Deliver { return implode(' ', $aReferences); } - /** - * Callback function to trim whitespace from a value, to be used in array_walk - */ - function trim_value ( &$value ) { - $value = trim($value); - } - /** * Converts ip address to hexadecimal string * diff --git a/functions/strings.php b/functions/strings.php index a6e3852a..5f99b385 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -1280,4 +1280,13 @@ function sq_count8bit($string) { return $count; } +/** + * Callback function to trim whitespace from a value, to be used in array_walk + * @param string $value value to trim + * @since 1.5.2 and 1.4.7 + */ +function sq_trim_value ( &$value ) { + $value = trim($value); +} + ?>