diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index ad80c8c91e4c0a91cd830ad07bf6818d6c4b6642..450701e52fed74482c9ac2167be6d6b402a13ae6 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -1052,8 +1052,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)) {
@@ -1123,6 +1124,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