diff options
author | Nikita Popov <nikic@php.net> | 2014-10-12 20:39:07 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-10-12 20:55:52 +0200 |
commit | b7e139a59ca7962c98ce1eb75150dd131978b41d (patch) | |
tree | 982ceb61cfedf3b6675957353cfd605b090c4a40 /Zend/tests | |
parent | 016a96c7c27fb244bd774a7fcd95edd30938a240 (diff) | |
download | php-git-b7e139a59ca7962c98ce1eb75150dd131978b41d.tar.gz |
Fix incdec of referenced properties
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.
Diffstat (limited to 'Zend/tests')
-rw-r--r-- | Zend/tests/incdec_ref_property.phpt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Zend/tests/incdec_ref_property.phpt b/Zend/tests/incdec_ref_property.phpt new file mode 100644 index 0000000000..a73b2912ab --- /dev/null +++ b/Zend/tests/incdec_ref_property.phpt @@ -0,0 +1,27 @@ +--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) |