com php-src: Normalize preg_replace_callback() return value: ext/pcre/php_pcre.c ext/pcre/tests/preg_r eplace_callback3.phpt

From: Date: Sat, 15 Oct 2016 21:58:26 +0000
Subject: com php-src: Normalize preg_replace_callback() return value: ext/pcre/php_pcre.c ext/pcre/tests/preg_r eplace_callback3.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95105@lists.php.net to get a copy of this message
Commit: b1fc1fb9376f22693b610961a097f6d0ff6dc484 Author: Nikita Popov <nikic@php.net> Sat, 15 Oct 2016 23:03:03 +0200 Parents: 663491b9bac96c27d20d8e0d517182f9c9b30409 Branches: PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b1fc1fb9376f22693b610961a097f6d0ff6dc484 Log: Normalize preg_replace_callback() return value One particular error case was returning the argument without casting to string. Changed paths: M ext/pcre/php_pcre.c M ext/pcre/tests/preg_replace_callback3.phpt Diff: diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index ef9569b..53e122c 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); diff --git a/ext/pcre/tests/preg_replace_callback3.phpt b/ext/pcre/tests/preg_replace_callback3.phpt index 6484c07..fc3218b 100644 --- a/ext/pcre/tests/preg_replace_callback3.phpt +++ b/ext/pcre/tests/preg_replace_callback3..phpt @@ -28,13 +28,13 @@ Warning: preg_replace_callback() expects at least 3 parameters, 2 given in %s on NULL Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d -int(3) +string(1) "3" Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d -int(3) +string(1) "3" Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d -int(3) +string(1) "3" Warning: preg_replace_callback() expects parameter 4 to be integer, string given in %s on line %d NULL

« previous php.cvs (#95105) next »