diff --git a/library/Icinga/Protocol/Ldap/LdapConnection.php b/library/Icinga/Protocol/Ldap/LdapConnection.php index 3d7db67e4..83c524745 100644 --- a/library/Icinga/Protocol/Ldap/LdapConnection.php +++ b/library/Icinga/Protocol/Ldap/LdapConnection.php @@ -1058,12 +1058,14 @@ class LdapConnection implements Selectable, Inspectable } } + Logger::debug('Cleaning entity attributes: %s', print_r($attributes, true)); + $cleanedAttributes = array(); for ($i = 0; $i < $attributes['count']; $i++) { $attribute_name = $attributes[$i]; if ($attributes[$attribute_name]['count'] === 1) { $attribute_value = $attributes[$attribute_name][0]; - } else { + } elseif ($attributes[$attribute_name]['count'] > 1) { $attribute_value = array(); for ($j = 0; $j < $attributes[$attribute_name]['count']; $j++) { $attribute_value[] = $attributes[$attribute_name][$j]; @@ -1124,6 +1126,8 @@ class LdapConnection implements Selectable, Inspectable return $rows; } + Logger::debug('Cleaned entity attributes: %s', print_r($cleanedAttributes, true)); + return (object) $cleanedAttributes; }