From: pallo Date: Mon, 5 Feb 2001 09:33:59 +0000 (+0000) Subject: Fixed PHP warning for LDAP entries without an e-mail address. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=7609273d61b2f995b35cace14f49d3b605a6e3e9 Fixed PHP warning for LDAP entries without an e-mail address. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1054 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/abook_ldap_server.php b/functions/abook_ldap_server.php index 8ed8e20a..57b4a43d 100644 --- a/functions/abook_ldap_server.php +++ b/functions/abook_ldap_server.php @@ -192,26 +192,30 @@ else $surname = $this->charset_decode($row['sn'][0]); // Add one row to result for each e-mail address - for($j = 0 ; $j < $row['mail']['count'] ; $j++) { - array_push($ret, array('nickname' => $nickname, - 'name' => $fullname, - 'firstname' => $firstname, - 'lastname' => $surname, - 'email' => $row['mail'][$j], - 'label' => $label, - 'phone' => $phone, - 'backend' => $this->bnum, - 'source' => &$this->sname)); - - // Limit number of hits - $returned_rows++; - if(($returned_rows >= $this->maxrows) && - ($this->maxrows > 0) ) { - ldap_free_result($sret); - return $ret; - } - - } + if(isset($row['mail']['count'])) { + for($j = 0 ; $j < $row['mail']['count'] ; $j++) { + array_push($ret, array('nickname' => $nickname, + 'name' => $fullname, + 'firstname' => $firstname, + 'lastname' => $surname, + 'email' => $row['mail'][$j], + 'label' => $label, + 'phone' => $phone, + 'backend' => $this->bnum, + 'source' => &$this->sname)); + + // Limit number of hits + $returned_rows++; + if(($returned_rows >= $this->maxrows) && + ($this->maxrows > 0) ) { + ldap_free_result($sret); + return $ret; + } + + } // for($j ...) + + } // isset($row['mail']['count']) + } ldap_free_result($sret);