summaryrefslogtreecommitdiffstats
path: root/main/phpldapadmin/phpldapadmin-1.2.3_use-preg_replace_callback.patch
blob: 60c086d1971eb3658db6f3521d84a24418394c2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 5a7edc892f1b3cccab74ed150f9d6843912a39ee Mon Sep 17 00:00:00 2001
From: Ben Chavet <ben@chavet.net>
Date: Thu, 29 May 2014 18:57:44 +0000
Subject: [PATCH] Use preg_replace_callback instead of /e in preg_replace to
 fix E_DEPRECATED warnings

---
 lib/ds_ldap.php | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php
index c346660..8bc1ef8 100644
--- a/lib/ds_ldap.php
+++ b/lib/ds_ldap.php
@@ -1116,13 +1116,14 @@ private function unescapeDN($dn) {
 
 		if (is_array($dn)) {
 			$a = array();
-			foreach ($dn as $key => $rdn)
-				$a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
-
+			foreach ($dn as $key => $rdn) {
+				$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return "''.chr(hexdec('${m[1]}')).''"; }, $rdn);
+			}
 			return $a;
 
-		} else
-			return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
+		} else {
+			return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return "''.chr(hexdec('${m[1]}')).''"; }, $dn);
+		}
 	}
 
 	public function getRootDSE($method=null) {