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: bwoebi@php.net 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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bwoebi@php.net
New email:
PHP Version: OS:

 

 [2018-06-21 10:51 UTC] bwoebi@php.net
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] bwoebi@php.net
-Assigned To: +Assigned To: bwoebi
 [2018-06-25 13:04 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2543e61aed67add7522e0b4cdf9a13cf3e441f6f
Log: Fixed bug #76509
 [2018-06-25 13:04 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC