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 :(
This commit is contained in:
Nikita Popov 2019-02-01 14:58:10 +01:00
parent 882dcb43f7
commit e366ceebad
4 changed files with 49 additions and 2 deletions

View file

@ -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);