php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79487 ::getStaticProperties() ignores property modifications
Submitted: 2020-04-17 16:36 UTC Modified: 2020-06-23 16:45 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: Reflection related
PHP Version: 7.4Git-2020-04-17 (Git) OS: Windows
Private report: No CVE-ID: None
 [2020-04-17 16:36 UTC] cmb@php.net
Description:
------------
If OPcache is enabled, any changes to static properties are not
recognized by ReflectionClass::getStaticProperties(); instead the
original values are returned.  This happens as of PHP 7.4.


Test script:
---------------
<?php
class Foo {
    public static $bar = 'orig';
}

Foo::$bar = 'new';
$rc = new ReflectionClass('Foo');
var_dump($rc->getStaticProperties());
?>


Expected result:
----------------
array(1) {
  ["bar"]=>
  string(3) "new"
}


Actual result:
--------------
array(1) {
  ["bar"]=>
  string(4) "orig"
}


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-18 15:28 UTC] cmb@php.net
This regression has apparently been introduced with commit
d57cd36[1], and is not particularly related to Windows.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d57cd36e47b627dee5b825760163f8e62e23ab28>
 [2020-04-21 13:15 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-04-21 13:16 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #79487: ::getStaticProperties() ignores property modifications
On GitHub:  https://github.com/php/php-src/pull/5429
Patch:      https://github.com/php/php-src/pull/5429.patch
 [2020-06-23 16:45 UTC] cmb@php.net
-Package: opcache +Package: Reflection related
 [2020-06-23 16:53 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a895bb6885fbceea3e8375816969d5510d8d082e
Log: Fix #79487: ::getStaticProperties() ignores property modifications
 [2020-06-23 16:53 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2020-06-23 17:31 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f3cccfde9e895a8760a94b87c6516e66eda05761
Log: Revert &quot;Fix #79487: ::getStaticProperties() ignores property modifications&quot;
 [2020-06-24 08:09 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef2130db88e3a1038c485eea9708cb2677dc9adc
Log: Fix #79487: ::getStaticProperties() ignores property modifications
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC