mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fix array/object cast of refcounted tmp var
This commit is contained in:
parent
2622cfc2fb
commit
e62edf2e58
3 changed files with 19 additions and 2 deletions
18
Zend/tests/double_array_cast.phpt
Normal file
18
Zend/tests/double_array_cast.phpt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
--TEST--
|
||||||
|
Double array cast
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$array = [1, 2, $x = 3];
|
||||||
|
var_dump((array) (array) $array);
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
[1]=>
|
||||||
|
int(2)
|
||||||
|
[2]=>
|
||||||
|
int(3)
|
||||||
|
}
|
|
@ -4043,7 +4043,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
||||||
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
|
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_OP1();
|
FREE_OP1_IF_VAR();
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9695,7 +9695,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||||
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
|
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
zval_ptr_dtor_nogc(free_op1.var);
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue