php-src/Zend/tests/bug72543_5.phpt
Nikita Popov 61d00a6cf3
Use COPY_DEREF instead of COPY_UNREF
This fixes the behavior when the storage location of the fetch is
modified before the operand is dereferenced by the using VM opcode.

Furthermore it elimiates references as a possible return value from
*_R opcodes, which will give us more opportunities for inferences,
in particular in regard to typed properties.
2018-06-25 11:23:59 +02:00

18 lines
280 B
PHP

--TEST--
Bug #72543.5 (different references behavior comparing to PHP 5)
--FILE--
<?php
$arr = [1];
$ref =& $arr[0];
var_dump($arr[0] + ($arr[0] = 2));
$obj = new stdClass;
$obj->prop = 1;
$ref =& $obj->prop;
var_dump($obj->prop + ($obj->prop = 2));
?>
--EXPECT--
int(3)
int(3)