Code

Fixed broken fetch() call on non existing resources.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Nov 2007 15:59:44 +0000 (15:59 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Nov 2007 15:59:44 +0000 (15:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7861 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_ldap.inc

index bcd2ccfb121f586613b9491b2dfc94e6117a7153..1973c820b5a408931b378533829a10d632d1f16b 100644 (file)
@@ -216,7 +216,6 @@ class LDAP{
         $basedn= LDAP::convert($basedn);
   
       $start = microtime();
-
       $this->sr = @ldap_list($this->cid, LDAP::fix($basedn), $filter,$attrs);
       $this->error = @ldap_error($this->cid);
       $this->resetResult();
@@ -276,8 +275,12 @@ class LDAP{
       if($this->hasres){
         if ($this->start == 0)
         {
-          $this->start = 1;
-          $this->re= @ldap_first_entry($this->cid, $this->sr);
+          if ($this->sr){
+            $this->start = 1;
+            $this->re= @ldap_first_entry($this->cid, $this->sr);
+          } else {
+            return array();
+          }
         } else {
           $this->re= @ldap_next_entry($this->cid, $this->re);
         }
@@ -816,7 +819,6 @@ class LDAP{
         if ($info= @ldap_get_values_len($this->cid, $ei, "$name")){
           $data= $info[0];
         }
-
       }
     }
     if($r_array==0)