php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76509 Inherited static properties can be desynchronized from their parent by ref
Submitted: 2018-06-21 10:51 UTC Modified: 2018-06-21 11:14 UTC
From: [email protected] Assigned: bwoebi (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0Git-2018-06-21 (Git) OS: Irrelevant
Private report: No CVE-ID: None
 [2018-06-21 10:51 UTC] [email protected]
Description:
------------
Inherited static properties shall be invariantly read from the same base source throughout the script life.

However assigning a reference to an inherited static property it stops being connected to their parent and this the child and the property stop sharing their common value.



Test script:
---------------
class Test {
    public static $x = 0;
}

class Test2 extends Test { }

Test2::$x = &$x;
$x = 1;
var_dump(Test::$x, Test2::$x);


Expected result:
----------------
int(1)
int(1)


Actual result:
--------------
int(0)
int(1)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-21 11:14 UTC] [email protected]
-Assigned To: +Assigned To: bwoebi
 [2018-06-25 13:04 UTC] [email protected]
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Mar 17 10:00:01 2026 UTC