From 0f538e7f06a683e615125a05bf17a92533b3d0c7 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Thu, 31 Mar 2016 12:59:35 +0200 Subject: [PATCH] lib/LDAP: LdapUtils::explodeDN replace deprecated use of eval in preg_replace fixes #11490 --- library/Icinga/Protocol/Ldap/LdapUtils.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 ); }