diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 828a7cb1223a91e75f9312cfe6aa6adbf50a82e1..0bd7d4b8b360cf5762329cde5b5ddfde92618b28 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