LSldap : combineFilters() : fix parameter support when array contain only one filter
authorBenjamin Renard <brenard@easter-eggs.com>
Fri, 28 Nov 2014 15:16:30 +0000 (16:16 +0100)
committerBenjamin Renard <brenard@easter-eggs.com>
Fri, 28 Nov 2014 15:16:30 +0000 (16:16 +0100)
public_html/includes/class/class.LSldap.php

index 8b3de80..43cf14c 100644 (file)
@@ -452,7 +452,12 @@ class LSldap {
   public static function combineFilters($op,$filters,$asStr=false) {
     if (is_array($filters) && !empty($filters)) {
       if (count($filters)==1) {
-        return $filters[0];
+        if ($asStr && $filters[0] instanceof Net_LDAP2_Filter) {
+          return $filters[0]->asString();
+        }
+        else {
+          return $filters[0];
+        }
       }
       $filter=Net_LDAP2_Filter::combine($op,$filters);
       if (!Net_LDAP2::isError($filter)) {