summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-01 14:58:10 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-02-01 15:02:31 +0100
commite366ceebade0fb3c30d4f99b82a11e5fc879d22e (patch)
tree91dde58d21dfb7c9bbaf99ddfc0622db5c6f105b /ext/mbstring/php_mbregex.c
parent882dcb43f72d14ad52be6f911d398f527d05a0cf (diff)
downloadphp-git-e366ceebade0fb3c30d4f99b82a11e5fc879d22e.tar.gz
Deprecate mb_ereg_replace with non-string pattern
I'm counting this towards the non-string needle deprecation from https://wiki.php.net/rfc/deprecations_php_7_3. I wasn't aware that mb_ereg_replace() is also affected by this issue. It's even more ridiculous than usual here, because the integer is interpreted as an ASCII codepoint, even though these are supposed to be multibyte functions :(
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index b0ed0bc8c7..254b0a02c6 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1049,6 +1049,10 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
arg_pattern = Z_STRVAL_P(arg_pattern_zval);
arg_pattern_len = Z_STRLEN_P(arg_pattern_zval);
} else {
+ php_error_docref(NULL, E_DEPRECATED,
+ "Non-string patterns will be interpreted as strings in the future. "
+ "Use an explicit chr() call to preserve the current behavior");
+
/* FIXME: this code is not multibyte aware! */
convert_to_long_ex(arg_pattern_zval);
pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval);