Bug #69238 [Nab]: getProperties() Doesn't list undeclared class properties

From: Date: Sun, 15 Mar 2015 11:30:36 +0000
Subject: Bug #69238 [Nab]: getProperties() Doesn't list undeclared class properties
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191400@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69238&edit=1 ID: 69238 Updated by: laruence@php.net Reported by: geolim4 at gmail dot com Summary: getProperties() Doesn't list undeclared class properties Status: Not a bug Type: Bug Package: Reflection related Operating System: Debian 3.2.65-1+deb7u1 x86_64 PHP Version: 5.6.6 Block user comment: N Private report: N New Comment: please refer to manual: http://php.net/manual/en/reflectionproperty.getvalue.php Previous Comments: ------------------------------------------------------------------------ [2015-03-15 02:25:03] geolim4 at gmail dot com Indeed, i missed it. But now i realize that getProperties() still have a bug, why does when i loop on $properties and i check call getValue() on each property, this method returns the DYNAMIC value and not the declared value. As you said that's Class related and not object related. ------------------------------------------------------------------------ [2015-03-15 02:14:47] reeze@php.net You need use ReflectionObject instead of ReflectionClass, since dynamic properties is not part of Class ------------------------------------------------------------------------ [2015-03-15 02:14:05] geolim4 at gmail dot com In that case the method name has a nonsense, the method should be named getDeclaredProperties() instead. Or an insufficiently completed docbook. But in that case, why the value returned is the dynamic value, and not declared value? I don't get it. If it's an excepted behavior, it must be explicitly mentioned in the docbook. ------------------------------------------------------------------------ [2015-03-15 02:06:35] laruence@php.net I think it's not a bug but a expected behavior, the baz is a dynamic property of a instance of class Foo ------------------------------------------------------------------------ [2015-03-14 23:46:43] geolim4 at gmail dot com As you can see the test was done inside a namespace, the bug is also reproduced in global scope. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=69238 -- Edit this bug report at https://bugs.php.net/bug.php?id=69238&edit=1

« previous php.bugs (#191400) next »