Bug #66821 [Opn->Nab]: stdClass properties cant be reflected
| From: | requinix@php.net | Date: | Tue, 04 Mar 2014 20:13:43 +0000 |
| Subject: | Bug #66821 [Opn->Nab]: stdClass properties cant be reflected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184521@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66821&edit=1
ID: 66821
Updated by: requinix@php.net
Reported by: wjaspers4 at gmail dot com
Summary: stdClass properties cant be reflected
-Status: Open
+Status: Not a bug
Type: Bug
Package: Reflection related
Operating System: Linux 3.2.0-23-generic x86_64
PHP Version: 5.5.9
Block user comment: N
Private report: N
New Comment:
ReflectionClass works on class definitions, not object instances. Use ReflectionObject instead.
Previous Comments:
------------------------------------------------------------------------
[2014-03-04 19:39:18] wjaspers4 at gmail dot com
This bug also exists in PHP 5.3.9
------------------------------------------------------------------------
[2014-03-04 19:02:19] wjaspers4 at gmail dot com
Description:
------------
A stdClass object cannot reflect its properties correctly.
Normal objects do reflect as expected.
Test script:
---------------
https://gist.github.com/wjaspers/9353164
Expected result:
----------------
NULL
NULL
Actual result:
--------------
NULL
PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Property
publicNullVar does not exist' in /test.php:19
Stack trace:
#0 /test.php(19): ReflectionClass->getProperty('publicNullVar')
#1 /test.php(49): Helper->__get('publicNullVar')
#2 {main}
thrown in /test.php on line 19
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66821&edit=1