From f956d095977e57241a3f10b1bcf8104aaae4a9f7 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 25 Jun 2015 15:51:19 +0200 Subject: [PATCH] LdapConnection: Fetch attributes required for sorting the results --- library/Icinga/Protocol/Ldap/LdapConnection.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/Icinga/Protocol/Ldap/LdapConnection.php b/library/Icinga/Protocol/Ldap/LdapConnection.php index af5ac5a9c..41b0bc917 100644 --- a/library/Icinga/Protocol/Ldap/LdapConnection.php +++ b/library/Icinga/Protocol/Ldap/LdapConnection.php @@ -608,6 +608,12 @@ class LdapConnection implements Selectable 'value' => $this->encodeSortRules($query->getOrder()) ) )); + } elseif ($query->hasOrder()) { + foreach ($query->getOrder() as $rule) { + if (! in_array($rule[0], $fields)) { + $fields[] = $rule[0]; + } + } } $results = @ldap_search( @@ -695,6 +701,12 @@ class LdapConnection implements Selectable 'value' => $this->encodeSortRules($query->getOrder()) ) )); + } elseif ($query->hasOrder()) { + foreach ($query->getOrder() as $rule) { + if (! in_array($rule[0], $fields)) { + $fields[] = $rule[0]; + } + } } $count = 0;