mirror of
https://github.com/php/php-src.git
synced 2025-01-24 04:33:39 +08:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix cache slot assignment for ASSIGN_OBJ_OP
This commit is contained in:
commit
5cdbfa897c
@ -448,11 +448,16 @@ int zend_optimizer_update_op2_const(zend_op_array *op_array,
|
||||
case ZEND_PRE_DEC_OBJ:
|
||||
case ZEND_POST_INC_OBJ:
|
||||
case ZEND_POST_DEC_OBJ:
|
||||
case ZEND_ASSIGN_OBJ_OP:
|
||||
TO_STRING_NOWARN(val);
|
||||
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
|
||||
opline->extended_value = alloc_cache_slots(op_array, 3);
|
||||
break;
|
||||
case ZEND_ASSIGN_OBJ_OP:
|
||||
TO_STRING_NOWARN(val);
|
||||
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
|
||||
ZEND_ASSERT((opline + 1)->opcode == ZEND_OP_DATA);
|
||||
(opline + 1)->extended_value = alloc_cache_slots(op_array, 3);
|
||||
break;
|
||||
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
|
||||
TO_STRING_NOWARN(val);
|
||||
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
|
||||
|
14
Zend/tests/assign_obj_op_cache_slot.phpt
Normal file
14
Zend/tests/assign_obj_op_cache_slot.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
The ASSIGN_OBJ_OP cache slot is on the OP_DATA opcode
|
||||
--FILE--
|
||||
<?php
|
||||
function test($a) {
|
||||
$b = "x";
|
||||
$a->$b = 1;
|
||||
$a->$b &= 1;
|
||||
var_dump($a->$b);
|
||||
}
|
||||
test(new stdClass);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
Loading…
Reference in New Issue
Block a user