]> git.sur5r.net Git - contagged/commitdiff
Replace preg_replace('//e') with preg_replace_callback 15/head
authorChristian Weiske <cweiske@cweiske.de>
Fri, 11 Aug 2017 19:55:57 +0000 (21:55 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 11 Aug 2017 19:56:09 +0000 (21:56 +0200)
Can be tested with the "*" filter

inc/functions.php

index cb75190c9d3475ecb1825b1d11d1935a46022dc9..db8c6b0c5fd107b7c36da69ce1bc2e76a79918f2 100644 (file)
@@ -357,9 +357,13 @@ function ldap_store_objectclasses($dn,$classes){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function ldap_filterescape($string){
-  return preg_replace('/([\x00-\x1F\*\(\)\\\\])/e',
-                            '"\\\\\".join("",unpack("H2","$1"))',
-                            $string);
+  return preg_replace_callback(
+    '/([\x00-\x1F\*\(\)\\\\])/',
+    function ($matches) {
+      return "\\" . implode("", unpack("H2", $matches[1]));
+    },
+    $string
+  );
 }
 
 /**