com php-src: Implement RFC "Deprecate mb_ereg_replace eva l option": NEWS UPGRADING ext/mbstring/php_mbrege x.c ext/mbstring/tests/bug43301.phpt
ext/mbst ring/tests/bug72164.phpt
| From: | JulienPauli | Date: | Mon, 11 Jul 2016 09:20:01 +0000 |
| Subject: | com php-src: Implement RFC "Deprecate mb_ereg_replace eva l option": NEWS UPGRADING ext/mbstring/php_mbrege x.c ext/mbstring/tests/bug43301.phpt ext/mbst ring/tests/bug72164.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92910@lists.php.net to get a copy of this message | ||
Commit: 0c98f51c8429b886dceee6c7ae003f1245727b2e
Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 9 Jul 2016 16:19:16 +0200
Committer: Julien Pauli <jpauli@php.net> Mon, 11 Jul 2016 11:20:01 +0200
Parents: cf8c217e8fb825b2667e71bd4c055497e338d5e3
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0c98f51c8429b886dceee6c7ae003f1245727b2e
Log:
Implement RFC "Deprecate mb_ereg_replace eval option"
<https://wiki.php.net/rfc/deprecate_mb_ereg_replace_eval_option>
has been
accepted, so we implement it.
Changed paths:
M NEWS
M UPGRADING
M ext/mbstring/php_mbregex.c
M ext/mbstring/tests/bug43301.phpt
M ext/mbstring/tests/bug72164..phpt
Diff:
diff --git a/NEWS b/NEWS
index 232d345..c28a440 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ PHP NEWS
. Fixed bug #71745 (FILTER_FLAG_NO_RES_RANGE does not cover whole 127.0.0.0/8
range). (bugs dot php dot net at majkl578 dot cz)
+- Mbstring:
+ . Deprecated mb_ereg_replace() eval option. (Rouven Weßling, cmb)
+
- PDO_pgsql:
. Fixed bug #70313 (PDO statement fails to throw exception). (Matteo)
. Fixed bug #72570 (Segmentation fault when binding parameters on a query
diff --git a/UPGRADING b/UPGRADING
index 0362e1c..8102506 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -100,6 +100,8 @@ PHP 7.1 UPGRADE NOTES
4. Deprecated Functionality
========================================
+- 'e' option of mb_ereg_replace() and mb_eregi_replace().
+
========================================
5. Changed Functions
========================================
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 5af7eb1...b427980 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -855,6 +855,9 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
syntax = MBREX(regex_default_syntax);
}
}
+ if (eval && !is_callable) {
+ php_error_docref(NULL, E_DEPRECATED, "The 'e' option is deprecated, use
mb_ereg_replace_callback instead");
+ }
if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) {
arg_pattern = Z_STRVAL_P(arg_pattern_zval);
arg_pattern_len = Z_STRLEN_P(arg_pattern_zval);
diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt
index 9c629ec..f209bd7 100644
--- a/ext/mbstring/tests/bug43301.phpt
+++ b/ext/mbstring/tests/bug43301.phpt
@@ -15,6 +15,8 @@ echo mb_ereg_replace($ptr,'$1',$txt,'e');
?>
--EXPECTF--
+Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback
instead in %s%ebug43301.php on line %d
+
Fatal error: Uncaught ParseError: syntax error, unexpected '1' (T_LNUMBER), expecting
variable (T_VARIABLE) or '{' or '$' in %sbug43301.php(%d) : mbregex replace:1
Stack trace:
#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have
g...', 'e')
diff --git a/ext/mbstring/tests/bug72164.phpt b/ext/mbstring/tests/bug72164.phpt
index bd58f7e..8666447 100644
--- a/ext/mbstring/tests/bug72164.phpt
+++ b/ext/mbstring/tests/bug72164.phpt
@@ -10,5 +10,6 @@ $var3 = NULL;
$var8 = mbereg_replace($var2,$var3,$var3,$var0);
var_dump($var8);
?>
---EXPECT--
+--EXPECTF--
+Deprecated: mbereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback
instead in %s%ebug72164.php on line %d
string(0) ""