From b1fc1fb9376f22693b610961a097f6d0ff6dc484 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 15 Oct 2016 23:03:03 +0200 Subject: Normalize preg_replace_callback() return value One particular error case was returning the argument without casting to string. --- ext/pcre/php_pcre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index ef9569b860..53e122c82b 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1584,7 +1584,7 @@ static PHP_FUNCTION(preg_replace_callback) if (!zend_is_callable(replace, 0, &callback_name)) { php_error_docref(NULL, E_WARNING, "Requires argument 2, '%s', to be a valid callback", ZSTR_VAL(callback_name)); zend_string_release(callback_name); - ZVAL_COPY(return_value, subject); + ZVAL_STR(return_value, zval_get_string(subject)); return; } zend_string_release(callback_name); -- cgit v1.2.1