|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-14 23:46 UTC] geolim4 at gmail dot com
[2015-03-15 02:06 UTC] laruence@php.net
[2015-03-15 02:14 UTC] geolim4 at gmail dot com
[2015-03-15 02:14 UTC] reeze@php.net
-Status: Open
+Status: Not a bug
[2015-03-15 02:14 UTC] reeze@php.net
[2015-03-15 02:25 UTC] geolim4 at gmail dot com
[2015-03-15 11:30 UTC] laruence@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 01:00:01 2025 UTC |
Description: ------------ It seem that ReflectionClass::getProperties() doesn't fetch undeclared properties of an object, even if you specify all the filters such ReflectionProperty::IS_xxxxxx Test script: --------------- class foo { public $bar = false; private $foobar = false; function __construct() { $this->bar = false; $this->foobar = true; $this->baz = true; } } $data = new foo(); $class = new \ReflectionClass($data); $properties = $class->getProperties(); \var_dump( $properties ); exit; Expected result: ---------------- array(2) { [0]=> &object(ReflectionProperty)#3 (2) { ["name"]=> string(3) "bar" ["class"]=> string(3) "foo" } [1]=> &object(ReflectionProperty)#4 (2) { ["name"]=> string(6) "foobar" ["class"]=> string(3) "foo" } [2]=> &object(ReflectionProperty)#4 (2) { ["name"]=> string(6) "baz" ["class"]=> string(3) "foo" } } Actual result: -------------- array(2) { [0]=> &object(ReflectionProperty)#3 (2) { ["name"]=> string(3) "bar" ["class"]=> string(3) "foo" } [1]=> &object(ReflectionProperty)#4 (2) { ["name"]=> string(6) "foobar" ["class"]=> string(3) "foo" } }