From a31f46421d7bf6f55dd9ac5876b8e2eacf7e0708 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 26 Feb 2019 15:32:18 +0100 Subject: Allow exceptions in __toString() RFC: https://wiki.php.net/rfc/tostring_exceptions And convert some object to string conversion related recoverable fatal errors into Error exceptions. Improve exception safety of internal code performing string conversions. --- ext/mbstring/php_mbregex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/mbstring/php_mbregex.c') diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 83cd25d89d..9fac8233ba 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -924,7 +924,9 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) { convert_to_long_ex(arg_pattern); /* get rid of decimal places */ } - convert_to_string_ex(arg_pattern); + if (!try_convert_to_string(arg_pattern)) { + return; + } /* don't bother doing an extended regex with just a number */ } -- cgit v1.2.1