summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-12-17 18:01:14 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-12-17 18:01:14 (GMT)
commit4de0c3411e6f5d3b936bf127c4a89fa3946024c9 (patch)
tree66794c49591e2981e2b166c4cb32a8a00ce58ebd
parent8ccab87b65ee775c21c75f3d1fff7ea519e5c7e2 (diff)
downloadNet_LDAP3-4de0c3411e6f5d3b936bf127c4a89fa3946024c9.tar.gz
Improved handling of vlv sort attributes (#4118)
-rw-r--r--lib/Net/LDAP3.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 1da3da3..c600656 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -1944,25 +1944,28 @@ class Net_LDAP3
// Not passing any sort attributes means you don't care
if (!empty($sort_attrs)) {
- $sort_attrs = (array) $sort_attrs;
+ $sort_attrs = array_map('strtolower', (array) $sort_attrs);
+
foreach ($vlv_index[$base_dn]['sort'] as $sss_config) {
+ $sss_config = array_map('strtolower', $sss_config);
if (count(array_intersect($sort_attrs, $sss_config)) == count($sort_attrs)) {
+ $this->_debug("Sorting matches");
+
return $sort_attrs;
}
}
- $this->_error("The requested sorting does not match any server-side sorting configuration");
-
- return false;
+ $this->_debug("Sorting does not match");
}
else {
- return $vlv_index[$base_dn]['sort'][0];
+ $sort = array_filter((array) $vlv_index[$base_dn]['sort'][0]);
+ $this->_debug("Sorting unimportant, use " . $sort[0]);
+
+ return $sort[0];
}
}
else {
- $this->_debug("Scope does not match. VLV: " . var_export($vlv_index[$base_dn]['scope'], true)
- . " while looking for " . var_export($scope, true));
- return false;
+ $this->_debug("Scope does not match");
}
}
else {
@@ -2045,7 +2048,7 @@ class Net_LDAP3
$_vlv_sort = array();
foreach ($vlv_indexes as $vlv_index_dn => $vlv_index_attrs) {
- $_vlv_sort[] = explode(' ', $vlv_index_attrs['vlvsort']);
+ $_vlv_sort[] = explode(' ', trim($vlv_index_attrs['vlvsort']));
}
$this->_vlv_indexes_and_searches[] = array(