Bug #69238 [NEW]: getProperties() Doesn't list undeclared class properties
From: geolim4 at gmail dot com
Operating system: Debian 3.2.65-1+deb7u1 x86_64
PHP version: 5.6.6
Package: Reflection related
Bug Type: Bug
Bug description:getProperties() Doesn't list undeclared class properties
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"
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=69238&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69238&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69238&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69238&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69238&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69238&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69238&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69238&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69238&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69238&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69238&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69238&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69238&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69238&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69238&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69238&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69238&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69238&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69238&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69238&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69238&r=mysqlcfg
Thread (7 messages)
- geolim4 at gmail dot com