From: cajus Date: Tue, 26 Sep 2006 11:48:43 +0000 (+0000) Subject: Porting reference to be more fault tolerant X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0509a5ca14eca35c8b357cdd59d59ae463adc237;p=gosa.git Porting reference to be more fault tolerant git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4785 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/generic/references/class_reference.inc b/plugins/generic/references/class_reference.inc index 3f53973be..fe047ba3a 100644 --- a/plugins/generic/references/class_reference.inc +++ b/plugins/generic/references/class_reference.inc @@ -106,6 +106,9 @@ class reference extends plugin } foreach ($attrs[$memberattr] as $uid){ $content= $this->getCacheObject($uid); + if ($content == NULL) { + continue; + } $addon.= '   '.$content['name'].''.$content['description'].''.$content['type'].' '; } } @@ -138,15 +141,19 @@ class reference extends plugin } else { $ldap->search("(uid=$dn)", array("cn", "objectClass", "description")); } - $attrs= $ldap->fetch(); - if (isset($attrs['description'])){ - $description= $attrs['description'][0]; + if ($ldap->count()){ + $attrs= $ldap->fetch(); + if (isset($attrs['description'])){ + $description= $attrs['description'][0]; + } else { + $description= "-"; + } + $this->objectCache[$dn]= array( 'name' => $attrs['cn'][0], + 'description' => "$description", + 'type' => $this->createContentString($attrs['objectClass'])); } else { - $description= "-"; + return NULL; } - $this->objectCache[$dn]= array( 'name' => $attrs['cn'][0], - 'description' => "$description", - 'type' => $this->createContentString($attrs['objectClass'])); } return ($this->objectCache[$dn]); }