diff --git a/include/functions.inc b/include/functions.inc
index 10621e0f408e31bf10854629856097ef0b1b7666..3188df56be4c05d745b1e47d5d7001a4d9e60a94 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -2413,75 +2413,6 @@ function load_all_classes()
   }
 }
 
-if (!function_exists('ldap_escape')) {
-  /* This bloc is for PHP<5.6 */
-  define('LDAP_ESCAPE_FILTER', 0x01);
-  define('LDAP_ESCAPE_DN',     0x02);
-
-  /* PHP version of ldap_escape for PHP<5.6 */
-  function ldap_escape($subject, $ignore = '', $flags = 0)
-  {
-    static $charMaps = array(
-      LDAP_ESCAPE_FILTER => array('\\', '*', '(', ')', "\x00"),
-      LDAP_ESCAPE_DN     => array('\\', ',', '=', '+', '<', '>', ';', '"', '#'),
-    );
-
-    // Pre-process the char maps on first call
-    if (!isset($charMaps[0])) {
-      $charMaps[0] = array();
-      for ($i = 0; $i < 256; $i++) {
-        $charMaps[0][chr($i)] = sprintf('\\%02x', $i);
-      }
-
-      for ($i = 0, $l = count($charMaps[LDAP_ESCAPE_FILTER]); $i < $l; $i++) {
-        $chr = $charMaps[LDAP_ESCAPE_FILTER][$i];
-        unset($charMaps[LDAP_ESCAPE_FILTER][$i]);
-        $charMaps[LDAP_ESCAPE_FILTER][$chr] = $charMaps[0][$chr];
-      }
-
-      for ($i = 0, $l = count($charMaps[LDAP_ESCAPE_DN]); $i < $l; $i++) {
-        $chr = $charMaps[LDAP_ESCAPE_DN][$i];
-        unset($charMaps[LDAP_ESCAPE_DN][$i]);
-        $charMaps[LDAP_ESCAPE_DN][$chr] = $charMaps[0][$chr];
-      }
-    }
-
-    // Create the base char map to escape
-    $flags = (int)$flags;
-    $charMap = array();
-    if ($flags & LDAP_ESCAPE_FILTER) {
-      $charMap += $charMaps[LDAP_ESCAPE_FILTER];
-    }
-    if ($flags & LDAP_ESCAPE_DN) {
-      $charMap += $charMaps[LDAP_ESCAPE_DN];
-    }
-    if (!$charMap) {
-      $charMap = $charMaps[0];
-    }
-
-    // Remove any chars to ignore from the list
-    $ignore = (string)$ignore;
-    for ($i = 0, $l = strlen($ignore); $i < $l; $i++) {
-      unset($charMap[$ignore[$i]]);
-    }
-
-    // Do the main replacement
-    $result = strtr($subject, $charMap);
-
-    // Encode leading/trailing spaces if LDAP_ESCAPE_DN is passed
-    if ($flags & LDAP_ESCAPE_DN) {
-      if ($result[0] === ' ') {
-        $result = '\\20' . substr($result, 1);
-      }
-      if ($result[strlen($result) - 1] === ' ') {
-        $result = substr($result, 0, -1) . '\\20';
-      }
-    }
-
-    return $result;
-  }
-}
-
 function ldap_escape_f($str, $ignore = '')
 {
   return ldap_escape($str, $ignore, LDAP_ESCAPE_FILTER);