From fae90da582ba7ac8ce6c0fdf753bbc6c7f7cbf9f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 19 Jun 2013 03:11:06 -0400
Subject: [PATCH] Fix debug setting in ldap classes

---
 program/lib/Roundcube/rcube_ldap_generic.php |    7 ++-----
 program/lib/Roundcube/rcube_ldap.php         |    8 ++++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index ef7e1b3..36f766d 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -205,8 +205,9 @@
         }
 
         // initialize ldap wrapper object
-        $this->ldap = new rcube_ldap_generic($this->prop, true);
+        $this->ldap = new rcube_ldap_generic($this->prop);
         $this->ldap->set_cache($this->cache);
+        $this->ldap->set_debug($this->debug);
 
         $this->_connect();
     }
@@ -1459,11 +1460,14 @@
      * Activate/deactivate debug mode
      *
      * @param boolean $dbg True if LDAP commands should be logged
-     * @access public
      */
     function set_debug($dbg = true)
     {
         $this->debug = $dbg;
+
+        if ($this->ldap) {
+            $this->ldap->set_debug($dbg);
+        }
     }
 
 
diff --git a/program/lib/Roundcube/rcube_ldap_generic.php b/program/lib/Roundcube/rcube_ldap_generic.php
index 16ca42a..097ddaf 100644
--- a/program/lib/Roundcube/rcube_ldap_generic.php
+++ b/program/lib/Roundcube/rcube_ldap_generic.php
@@ -76,10 +76,9 @@
     /**
     * Object constructor
     *
-    * @param array   $p       LDAP connection properties
-    * @param boolean $debug   Enables debug mode
+    * @param array $p LDAP connection properties
     */
-    function __construct($p, $debug = false)
+    function __construct($p)
     {
         $this->config = $p;
 
@@ -88,8 +87,6 @@
 
         if (!is_array($p['hosts']) && !empty($p['host']))
             $this->config['hosts'] = array($p['host']);
-
-        $this->debug = $debug;
     }
 
     /**

--
Gitblit v1.9.1