From f052e1c9a3896150013e7ad850811c33ceb193fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Tue, 13 Mar 2018 14:24:31 +0100
Subject: [PATCH] :ambulance: fix(ldap) Return number of entry imported and
 avoid PHP errors

issue #5789
---
 include/class_ldap.inc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 828a7cb12..0bd7d4b8b 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -1016,8 +1016,9 @@ class LDAP
     }
 
     /* Joining lines */
-    $line   = NULL;
-    $entry  = array();
+    $line       = NULL;
+    $entry      = array();
+    $entries    = array();
     $entryStart = -1;
     foreach ($fileLines as $lineNumber => $fileLine) {
       if (preg_match('/^ /', $fileLine)) {
@@ -1087,6 +1088,8 @@ class LDAP
         throw new LDIFImportException(sprintf(_('Error while importing dn: "%s", please check your LDIF from line %s on!'), $entry['dn'][0], $startLine));
       }
     }
+
+    return count($entries);
   }
 
   /*! \brief Function to Imports a single entry
-- 
GitLab