lib/Auth

Aleksander Machniak machniak at kolabsys.com
Tue Apr 16 13:38:02 CEST 2013


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

New commits:
commit af9810a07bfc6b6d6149ae59baa43227b4ed9f8d
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 8137356..853ec8f 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -253,7 +253,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);
         }
 
@@ -711,7 +711,7 @@ class LDAP extends Net_LDAP3 {
 
         return array(
             'list' => $entries,
-            'count' => $result->count()
+            'count' => is_object($result) ? $result->count() : 0,
         );
     }
 
@@ -919,6 +919,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