php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70223 Incrementing value returned by magic getter
Submitted: 2015-08-09 19:20 UTC Modified: 2015-08-10 08:06 UTC
From: bugadani at gmail dot com Assigned: laruence (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.0beta3 OS: any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugadani at gmail dot com
New email:
PHP Version: OS:

 

 [2015-08-09 19:20 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-10 08:06 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2015-08-10 09:18 UTC] laruence@php.net
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)
 [2015-08-10 09:18 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2015-08-18 16:24 UTC] ab@php.net
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)
 [2016-07-20 11:37 UTC] davey@php.net
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)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC