php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41670 ReflectionProperty class in reflection api lacks getDefaultValue method
Submitted: 2007-06-12 11:45 UTC Modified: 2011-07-03 10:02 UTC
Votes:34
Avg. Score:4.9 ± 0.5
Reproduced:32 of 32 (100.0%)
Same Version:7 (21.9%)
Same OS:2 (6.2%)
From: killgec at gmail dot com Assigned: cataphract (profile)
Status: Wont fix Package: *General Issues
PHP Version: 5.2.3 OS:
Private report: No CVE-ID: None
 [2007-06-12 11:45 UTC] killgec at gmail dot com
Description:
------------
ReflectionProperty class in reflection api lacks getDefaultValue method.

So there is no way to find out if a property in a class examined with reflection API has a default value, and what this value is.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-06 08:35 UTC] no2spam at chello dot nl
This would be very useful for me. Especially for code generation
 [2010-06-01 02:37 UTC] jonwage at gmail dot com
I could use this feature as well.
 [2010-07-27 22:13 UTC] rasmus at mindplay dot dk
Yep, missing for me too - this is one of the two missing features holding back some of the really cool stuff you could do with reflection... there are no good workarounds for this, it really needs to be fixed.
 [2010-10-15 00:00 UTC] cataphract@php.net
-Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: cataphract
 [2010-10-27 00:23 UTC] cataphract@php.net
Note there's already ReflectionClass::getDefaultProperties() and ReflectionClass::getStaticProperties().
 [2011-07-03 10:02 UTC] cataphract@php.net
-Status: Assigned +Status: Wont fix
 [2011-07-03 10:02 UTC] cataphract@php.net
Closing as Wont fix because the original value of static properties for user-land classes is not retained.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 10:01:35 2025 UTC