From 80e1404151d718a8ac921c9825cadcd2dcfcbba4 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 16 Jan 2008 17:46:56 +0000 Subject: fixed bug #2542 - switched to foreach() in clean_email() to work with associative arrays or numerically indexed arrays that are not sequential from 0. --- system/libraries/Email.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 7b5ebca8c..cbf6e23f0 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -684,13 +684,17 @@ class CI_Email { } $clean_email = array(); - - for ($i=0; $i < count($email); $i++) + + foreach ($email as $addy) { - if (preg_match( '/\<(.*)\>/', $email[$i], $match)) - $clean_email[] = $match['1']; + if (preg_match( '/\<(.*)\>/', $addy, $match)) + { + $clean_email[] = $match['1']; + } else - $clean_email[] = $email[$i]; + { + $clean_email[] = $addy; + } } return $clean_email; -- cgit v1.2.3-24-g4f1b