1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Avoid unnecessary string refcounting in ext/pcre (#17893)

This commit is contained in:
Niels Dossche
2025-02-23 00:23:39 +01:00
committed by GitHub
parent 1eacd4aea0
commit 03f97fc34b

View File

@@ -1563,9 +1563,12 @@ static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cach
fci->params = &arg; fci->params = &arg;
zend_call_function(fci, fcc); zend_call_function(fci, fcc);
zval_ptr_dtor(&arg); zval_ptr_dtor(&arg);
if (EXPECTED(Z_TYPE(retval) == IS_STRING)) {
return Z_STR(retval);
}
/* No Exception has occurred */ /* No Exception has occurred */
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) { else if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result_str = zval_try_get_string(&retval); result_str = zval_try_get_string_func(&retval);
} }
zval_ptr_dtor(&retval); zval_ptr_dtor(&retval);