Fix for issue #103 - hexdec() causes an deprecation notice when invalid chars are used

This commit is contained in:
Deon George 2020-09-19 17:09:29 +10:00
parent 9fac4b415a
commit 0c334f0385

View File

@ -1146,12 +1146,12 @@ class ldap extends DS {
if (is_array($dn)) { if (is_array($dn)) {
$a = array(); $a = array();
foreach ($dn as $key => $rdn) { foreach ($dn as $key => $rdn) {
$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec('${m[1]}')); }, $rdn); $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec($m[1])); }, $rdn);
} }
return $a; return $a;
} else { } else {
return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec('${m[1]}')); }, $dn); return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec($m[1])); }, $dn);
} }
} }