X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fphone.php;h=21be6a67a863033e7688da1499f0f3e87d3535ec;hb=c90dde9391588ae99bd1852fa1e95f32b016e013;hp=c70928157e12d06ba3dd5d242f928ccf3708b743;hpb=12160997cbae052d05f0ef4cb6fd5e9fe27eadb1;p=platal.git diff --git a/classes/phone.php b/classes/phone.php index c709281..21be6a6 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -1,6 +1,6 @@ numRows() == 0) { // No country found, does not format more than prepending a '+' sign. $this->error = true; @@ -328,15 +329,17 @@ class Phone static private function formArrayWalk(array $data, $function, &$success = true, $requiresEmptyPhone = false, $maxPublicity = null) { $phones = array(); - foreach ($data as $item) { - $phone = new Phone($item); - $success = (!$phone->error && ($phone->format() || $phone->isEmpty()) && $success); - if (!$phone->isEmpty()) { - // Restrict phone visibility to $maxPublicity - if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) { - $phone->pub = $maxPublicity; + if (!is_null($data)) { + foreach ($data as $item) { + $phone = new Phone($item); + $success = (!$phone->error && ($phone->format() || $phone->isEmpty()) && $success); + if (!$phone->isEmpty()) { + // Restrict phone visibility to $maxPublicity + if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) { + $phone->pub = $maxPublicity; + } + $phones[] = call_user_func(array($phone, $function)); } - $phones[] = call_user_func(array($phone, $function)); } } if (count($phones) == 0 && $requiresEmptyPhone) {