diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-24 10:03:46 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-24 10:05:51 +0200 |
commit | ef2130db88e3a1038c485eea9708cb2677dc9adc (patch) | |
tree | 74411d99659eff5aa9e93cad05d7c1e8b16e35f1 /ext/reflection/tests | |
parent | f3cccfde9e895a8760a94b87c6516e66eda05761 (diff) | |
download | php-git-ef2130db88e3a1038c485eea9708cb2677dc9adc.tar.gz |
Fix #79487: ::getStaticProperties() ignores property modifications
When retrieving the static class properties via reflection, we have to
cater to possible modifications.
Diffstat (limited to 'ext/reflection/tests')
-rw-r--r-- | ext/reflection/tests/bug79487.phpt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/reflection/tests/bug79487.phpt b/ext/reflection/tests/bug79487.phpt new file mode 100644 index 0000000000..5185c98bba --- /dev/null +++ b/ext/reflection/tests/bug79487.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #79487 (::getStaticProperties() ignores property modifications) +--FILE-- +<?php +class Foo { + public static $bar = 'orig'; +} + +Foo::$bar = 'new'; +$rc = new ReflectionClass('Foo'); +var_dump($rc->getStaticProperties()); + +class A { + public static $a = 'A old'; +} +class B extends A { + public static $b = 'B old'; +} + +$rc = new ReflectionClass(B::class); +A::$a = 'A new'; +var_dump($rc->getStaticProperties()); +?> +--EXPECT-- +array(1) { + ["bar"]=> + string(3) "new" +} +array(2) { + ["b"]=> + string(5) "B old" + ["a"]=> + string(5) "A new" +} |