Branch 'kolab-webadmin-3.0' - lib/Auth

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Thu May 16 20:33:09 CEST 2013


 lib/Auth/LDAP.php |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 9516e7538cbeb8f02b52ed08836c7a789ae15e86
Author: Aleksander Machniak <alec at alec.pl>
Date:   Tue Apr 16 13:37:27 2013 +0200

    Fix PHP fatal errors when search_entries() returns false (on error ) (Bug #1756)

diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index d3116c8..33f91f4 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -260,7 +260,7 @@ class LDAP extends Net_LDAP3 {
 
         $result = $this->search_entries($this->config_get('root_dn'), '(objectclass=*)', 'sub', null, $search);
 
-        if ($result->count() > 0) {
+        if ($result && $result->count() > 0) {
             return $result->entries(TRUE);
         } else {
             return FALSE;
@@ -652,7 +652,7 @@ class LDAP extends Net_LDAP3 {
 
         return array(
             'list' => $entries,
-            'count' => $result->count()
+            'count' => is_object($result) ? $result->count() : 0,
         );
     }
 
@@ -860,6 +860,10 @@ class LDAP extends Net_LDAP3 {
 
     private function sort_and_slice(&$result, &$params)
     {
+        if (!is_object($result)) {
+            return array();
+        }
+
         $entries = $result->entries(true);
 
         if ($this->vlv_active) {





More information about the commits mailing list