From 00e8ad5821bf092834c026faa560abf153a3ea5e Mon Sep 17 00:00:00 2001 From: aNiassy Date: Mon, 24 Oct 2011 08:22:48 +0000 Subject: [PATCH] [-] #PSCFI-3773 : Added conditions in order to test the var $toName (to know if it's a string or an array) --- classes/Mail.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/classes/Mail.php b/classes/Mail.php index b631a7bdd..a23422301 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -64,8 +64,11 @@ class MailCore } // Do not crash for this error, that may be a complicated customer name - if (!empty($toName) AND !Validate::isMailName($toName)) - $toName = NULL; + if(is_string($toName)) + { + if (!empty($toName) AND !Validate::isMailName($toName)) + $toName = NULL; + } if (!Validate::isTplName($template)) { @@ -92,8 +95,11 @@ class MailCore Tools::dieOrLog(Tools::displayError('Error: invalid email address'), $die); return false; } - if ($toName AND is_array($toName) AND Validate::isGenericName($toName[$key])) - $to_name = $toName[$key]; + if(is_array($toName)) + { + if ($toName AND is_array($toName) AND Validate::isGenericName($toName[$key])) + $to_name = $toName[$key]; + } $to_list->addTo($addr, $to_name); } $to_plugin = $to[0];