1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00

Merge branch 'PHP-7.4'

* PHP-7.4:
  Fixed bug #80049
This commit is contained in:
Nikita Popov
2020-09-03 17:13:47 +02:00
3 changed files with 16 additions and 0 deletions

14
Zend/tests/bug80049.phpt Normal file
View File

@@ -0,0 +1,14 @@
--TEST--
Bug #80049: Memleak when coercing integers to string via variadic argument
--FILE--
<?php
function coerceToString(string ...$strings) {
var_dump($strings);
}
coerceToString(...[123]);
?>
--EXPECT--
array(1) {
[0]=>
string(3) "123"
}

View File

@@ -5463,6 +5463,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED, CACHE_SLOT)
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
zval *param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED(ZEND_TYPE_IS_SET(arg_info->type))) {
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
do {
if (UNEXPECTED(!zend_verify_variadic_arg_type(EX(func), arg_info, arg_num, param, CACHE_ADDR(opline->extended_value)))) {
ZEND_HASH_FILL_FINISH();

View File

@@ -3907,6 +3907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
zval *param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED(ZEND_TYPE_IS_SET(arg_info->type))) {
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
do {
if (UNEXPECTED(!zend_verify_variadic_arg_type(EX(func), arg_info, arg_num, param, CACHE_ADDR(opline->extended_value)))) {
ZEND_HASH_FILL_FINISH();