From be38f66bfa474845fe25e3aece17efc44d1dc6ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.bernigaud@opensides.be>
Date: Thu, 3 Dec 2015 10:22:12 +0100
Subject: [PATCH] Fixes #4519 Attempt at a few optimisations

---
 include/class_ldap.inc            | 8 +++-----
 include/class_ldapMultiplexer.inc | 5 +----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 7e1f6bd23..349a7ae18 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -703,7 +703,8 @@ class LDAP
       $delarray = array();
 
       /* Get sorted list of dn's to delete */
-      $this->ls($srp, "(objectClass=*)", $deletedn);
+      $this->cd($deletedn);
+      $this->search($srp, "(objectClass=*)");
       while ($this->fetch($srp)) {
         $deldn            = $this->getDN($srp);
         $delarray[$deldn] = strlen($deldn);
@@ -713,11 +714,8 @@ class LDAP
 
       /* Really Delete ALL dn's in subtree */
       foreach (array_keys($delarray) as $key) {
-        $this->rmdir_recursive($srp, $key);
+        $r = @ldap_delete($this->cid, LDAP::fix($key));
       }
-
-      /* Finally Delete own Node */
-      $r = @ldap_delete($this->cid, LDAP::fix($deletedn));
       $this->error = @ldap_error($this->cid);
       return ($r ? $r : 0);
     } else {
diff --git a/include/class_ldapMultiplexer.inc b/include/class_ldapMultiplexer.inc
index 027abeb6d..f7faa9e23 100644
--- a/include/class_ldapMultiplexer.inc
+++ b/include/class_ldapMultiplexer.inc
@@ -64,10 +64,7 @@ class ldapMultiplexer {
       array_unshift($parameters, $this->sr);
     }
 
-    $class  = new ReflectionClass($this->object);
-    $method = $class->getMethod($methodName);
-
-    return $method->invokeArgs($this->object, $parameters);
+    return call_user_func_array(array($this->object, $methodName), $parameters);
   }
 
   /*
-- 
GitLab