mirror of
https://github.com/php/php-src.git
synced 2024-12-19 15:00:15 +08:00
b7e139a59c
I thought these SEPARATE_ZVAL_IF_NOT_REF usages were safe at first, because incdec op supports reference variables. However this violates the constraint that IS_TMP_VAR variables may not be references (which is an issue if you use the result of the incdec op). Still need to fix the cases where read_property/write_property is used.
28 lines
389 B
PHP
28 lines
389 B
PHP
--TEST--
|
|
Incrementing and decrementing a referenced property
|
|
--FILE--
|
|
<?php
|
|
|
|
$obj = new stdClass;
|
|
$obj->prop = 1;
|
|
$ref =& $obj->prop;
|
|
var_dump(++$obj->prop);
|
|
var_dump($obj->prop);
|
|
var_dump($obj->prop++);
|
|
var_dump($obj->prop);
|
|
var_dump(--$obj->prop);
|
|
var_dump($obj->prop);
|
|
var_dump($obj->prop--);
|
|
var_dump($obj->prop);
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(2)
|
|
int(2)
|
|
int(2)
|
|
int(3)
|
|
int(2)
|
|
int(2)
|
|
int(2)
|
|
int(1)
|