php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wjaspers4 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-03-04 19:02 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] requinix@php.net
-Status: Open +Status: Not a bug
 [2014-03-04 20:13 UTC] requinix@php.net
ReflectionClass works on class definitions, not object instances. Use ReflectionObject instead.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 14:01:30 2024 UTC