|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66821 stdClass properties cant be reflected
Submitted: 2014-03-04 19:02 UTC Modified: 2014-03-04 20:13 UTC
From: wjaspers4 at gmail dot com Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 5.5.9 OS: Linux 3.2.0-23-generic x86_64
Private report: No CVE-ID: None
 [2014-03-04 19:02 UTC] wjaspers4 at gmail dot com
A stdClass object cannot reflect its properties correctly.
Normal objects do reflect as expected.

Test script:

Expected result:

Actual result:
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-04 19:39 UTC] wjaspers4 at gmail dot com
This bug also exists in PHP 5.3.9
 [2014-03-04 20:13 UTC]
-Status: Open +Status: Not a bug
 [2014-03-04 20:13 UTC]
ReflectionClass works on class definitions, not object instances. Use ReflectionObject instead.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 19:01:27 2023 UTC