fixed errors when schema is not readable

This commit is contained in:
Roland Gruber 2005-11-02 12:17:39 +00:00
parent 835583383b
commit 4269c46e1f
1 changed files with 15 additions and 2 deletions

View File

@ -189,8 +189,13 @@ class Ldap{
$info = @ldap_get_entries($this->server,$sr); $info = @ldap_get_entries($this->server,$sr);
if ($info) { if ($info) {
$this->objectClasses = $info[0]['objectclasses']; $this->objectClasses = $info[0]['objectclasses'];
if (is_array($this->objectClasses)) {
array_shift($this->objectClasses); array_shift($this->objectClasses);
} }
else {
$this->objectClasses = array();
}
}
} }
// if search failed save empty result // if search failed save empty result
else $this->objectClasses = array(); else $this->objectClasses = array();
@ -204,8 +209,16 @@ class Ldap{
$info = @ldap_get_entries($this->server,$sr); $info = @ldap_get_entries($this->server,$sr);
if ($info) { if ($info) {
$attributes = $info[0]['attributetypes']; $attributes = $info[0]['attributetypes'];
if (is_array($attributes)) {
array_shift($attributes); array_shift($attributes);
} }
else {
$attributes = array();
}
}
}
else {
$attributes = array();
} }
// build Attribute list // build Attribute list
for ($i=0; $i<count($attributes); $i++) { for ($i=0; $i<count($attributes); $i++) {