From b10f7aafb7fcf31af86795d45a8d227540dfb0fe Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 25 Jul 2012 12:54:23 +0200 Subject: LDAP: silence warning, but handle the error --- apps/user_ldap/lib/access.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index eef471f1598..ff94b00a842 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -48,7 +48,12 @@ abstract class Access { return false; } $cr = $this->connection->getConnectionResource(); - $rr = ldap_read($cr, $dn, 'objectClass=*', array($attr)); + $rr = @ldap_read($cr, $dn, 'objectClass=*', array($attr)); + if(!is_resource($rr)) { + \OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG); + //in case an error occurs , e.g. object does not exist + return false; + } $er = ldap_first_entry($cr, $rr); //LDAP attributes are not case sensitive $result = \OCP\Util::mb_array_change_key_case(ldap_get_attributes($cr, $er), MB_CASE_LOWER, 'UTF-8'); -- cgit v1.2.3