lib: Don't provide LDAP server-side sort request if the query has no order
refs #10147
This commit is contained in:
parent
79c9a8af9b
commit
eff9249863
|
@ -667,17 +667,20 @@ class LdapConnection implements Selectable, Inspectable
|
||||||
$ds = $this->getConnection();
|
$ds = $this->getConnection();
|
||||||
|
|
||||||
$serverSorting = $this->getCapabilities()->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID);
|
$serverSorting = $this->getCapabilities()->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID);
|
||||||
if ($serverSorting && $query->hasOrder()) {
|
|
||||||
ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array(
|
if ($query->hasOrder()) {
|
||||||
array(
|
if ($serverSorting) {
|
||||||
'oid' => LdapCapabilities::LDAP_SERVER_SORT_OID,
|
ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array(
|
||||||
'value' => $this->encodeSortRules($query->getOrder())
|
array(
|
||||||
)
|
'oid' => LdapCapabilities::LDAP_SERVER_SORT_OID,
|
||||||
));
|
'value' => $this->encodeSortRules($query->getOrder())
|
||||||
} elseif ($query->hasOrder()) {
|
)
|
||||||
foreach ($query->getOrder() as $rule) {
|
));
|
||||||
if (! in_array($rule[0], $fields)) {
|
} else {
|
||||||
$fields[] = $rule[0];
|
foreach ($query->getOrder() as $rule) {
|
||||||
|
if (! in_array($rule[0], $fields)) {
|
||||||
|
$fields[] = $rule[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,7 +781,7 @@ class LdapConnection implements Selectable, Inspectable
|
||||||
// server to return results even if the paged search request cannot be satisfied
|
// server to return results even if the paged search request cannot be satisfied
|
||||||
ldap_control_paged_result($ds, $pageSize, false, $cookie);
|
ldap_control_paged_result($ds, $pageSize, false, $cookie);
|
||||||
|
|
||||||
if ($serverSorting) {
|
if ($serverSorting && $query->hasOrder()) {
|
||||||
ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array(
|
ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array(
|
||||||
array(
|
array(
|
||||||
'oid' => LdapCapabilities::LDAP_SERVER_SORT_OID,
|
'oid' => LdapCapabilities::LDAP_SERVER_SORT_OID,
|
||||||
|
|
Loading…
Reference in New Issue