lib/ext

Aleksander Machniak machniak at kolabsys.com
Mon Jun 17 09:47:15 CEST 2013


 lib/ext/Net/LDAP3.php |   24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

New commits:
commit 8073d78021ae902d782d44c3dcd8b94b5e15a290
Author: Aleksander Machniak <alec at alec.pl>
Date:   Mon Jun 17 09:46:57 2013 +0200

    Fix PHP Fatal error:  Call to a member function count() on a non-object

diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index f532010..3e9c849 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -474,7 +474,7 @@ class Net_LDAP3
             {
                 if ($this->config_get('use_tls', false) === true) {
                     if (!ldap_start_tls($lc)) {
-                        $this->_debug("S: Could not start TLS.");
+                        $this->_debug("S: Could not start TLS. " . ldap_error($lc));
                         continue;
                     }
                 }
@@ -498,21 +498,11 @@ class Net_LDAP3
                     );
                 }
 
-                if ($this->config_get('referrals', false)) {
-                    ldap_set_option(
-                            $lc,
-                            LDAP_OPT_REFERRALS,
-                            (bool)($this->config_get('referrals'))
-                        );
-
-                } else {
-                    ldap_set_option(
-                            $lc,
-                            LDAP_OPT_REFERRALS,
-                            (bool)($this->config_get('referrals'))
-                        );
-
-                }
+                ldap_set_option(
+                    $lc,
+                    LDAP_OPT_REFERRALS,
+                    (bool)($this->config_get('referrals'))
+                );
 
                 break;
             }
@@ -721,7 +711,7 @@ class Net_LDAP3
         $this->config_set('return_attributes', array_keys($attributes));
         $result = $this->search($base_dn, $filter);
 
-        if ($result->count() > 0) {
+        if ($result && $result->count() > 0) {
             $this->_debug("Results found: " . implode(', ', array_keys($result->entries(true))));
             return $result->entries(true);
         }





More information about the commits mailing list