diff --git a/library/Icinga/Protocol/Ldap/LdapUtils.php b/library/Icinga/Protocol/Ldap/LdapUtils.php index 68031fa57..3d86cf100 100644 --- a/library/Icinga/Protocol/Ldap/LdapUtils.php +++ b/library/Icinga/Protocol/Ldap/LdapUtils.php @@ -28,9 +28,11 @@ class LdapUtils $res = ldap_explode_dn($dn, $with_type ? 0 : 1); foreach ($res as $k => $v) { - $res[$k] = preg_replace( - '/\\\([0-9a-f]{2})/ei', - "chr(hexdec('\\1'))", + $res[$k] = preg_replace_callback( + '/\\\([0-9a-f]{2})/i', + function ($m) { + return chr(hexdec($m[1])); + }, $v ); }