From 0509a5ca14eca35c8b357cdd59d59ae463adc237 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 26 Sep 2006 11:48:43 +0000 Subject: [PATCH] Porting reference to be more fault tolerant git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4785 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../generic/references/class_reference.inc | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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]); } -- 2.30.2