Bug #70223 [Asn->Csd]: Incrementing value returned by magic getter
Edit report at https://bugs.php.net/bug.php?id=70223&edit=1
ID: 70223
Updated by: laruence@php.net
Reported by: bugadani at gmail dot com
Summary: Incrementing value returned by magic getter
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: any
PHP Version: 7.0.0beta3
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=aa546256e3f3ddf609f5f64ab977650a45652442
Log: Fixed bug #70223 (Incrementing value returned by magic getter)
Previous Comments:
------------------------------------------------------------------------
[2015-08-09 19:20:16] bugadani at gmail dot com
Description:
------------
PHP7 has a bug with post-incrementing and/or decrementing variables returned by reference via magic
getters.
See: http://3v4l.org/mvNGC
Test script:
---------------
<?php
class A {
private $foo = 0;
public function &__get($foo){ return $this->foo; }
}
$a = new A;
echo $a->f++;
echo $a->f++;
echo $a->f++;
Expected result:
----------------
012
Actual result:
--------------
112
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70223&edit=1
Thread (2 messages)