summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2012-03-04 13:39:12 +0000
committerNikita Popov <nikic@php.net>2012-03-04 13:39:12 +0000
commitbe202d3d352e82c5d6825772c2709894f2bc4a21 (patch)
tree92d1e048469941c596dc686d7775708cea31dfb8
parent67db5de6b215a20683da45a4d45ee715b836832f (diff)
downloadphp-git-be202d3d352e82c5d6825772c2709894f2bc4a21.tar.gz
Deprecate /e modifier
See https://wiki.php.net/rfc/remove_preg_replace_eval_modifier.
-rw-r--r--ext/pcre/php_pcre.c4
-rw-r--r--ext/pcre/tests/002.phpt2
-rw-r--r--ext/pcre/tests/004.phpt4
-rw-r--r--tests/lang/bug24403.phpt3
4 files changed, 11 insertions, 2 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index c9d707280c..6b0a41fbed 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1019,6 +1019,10 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
replace_end = replace + replace_len;
}
+ if (eval) {
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "The /e modifier is deprecated, use preg_replace_callback instead");
+ }
+
/* Calculate the size of the offsets array, and allocate memory for it. */
rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);
if (rc < 0) {
diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt
index 00f68f3651..fd245633d3 100644
--- a/ext/pcre/tests/002.phpt
+++ b/ext/pcre/tests/002.phpt
@@ -34,6 +34,8 @@ string(12) "a${1b${1c${1"
Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line 11
NULL
+Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in %s on line 12
+
Parse error: %s in %s002.php(12) : regexp code on line 1
Fatal error: preg_replace(): Failed evaluating code:
diff --git a/ext/pcre/tests/004.phpt b/ext/pcre/tests/004.phpt
index b1e9586626..1fae406b16 100644
--- a/ext/pcre/tests/004.phpt
+++ b/ext/pcre/tests/004.phpt
@@ -16,7 +16,7 @@ var_dump(preg_replace(array('@//.*@S', '@/\*.*\*/@SsUe'), array('', 'preg_replac
var_dump(preg_split('/PHP_(?:NAMED_)?(?:FUNCTION|METHOD)\s*\((\w+(?:,\s*\w+)?)\)/S', "PHP_FUNCTION(s, preg_match)\n{\nlalala", -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
?>
---EXPECT--
+--EXPECTF--
int(2)
array(2) {
[0]=>
@@ -117,6 +117,8 @@ array(1) {
}
}
}
+
+Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in %s on line %d
string(9) "hello
diff --git a/tests/lang/bug24403.phpt b/tests/lang/bug24403.phpt
index fe99257d3d..8f4934e7b9 100644
--- a/tests/lang/bug24403.phpt
+++ b/tests/lang/bug24403.phpt
@@ -17,4 +17,5 @@ class a
}
new a();
?>
---EXPECT--
+--EXPECTF--
+Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in %s on line %d