ID: 42258 Updated by: [EMAIL PROTECTED] Reported By: vincent dot hoen at gmail dot com -Status: Assigned +Status: Bogus Bug Type: Class/Object related Operating System: windows xp PHP Version: 5.2.4RC1 Assigned To: johannes New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Your code is wrong. The parameter to getValue has to be an instance of the reflected class, not the reflection object. Try <?php class test{ public $test = 'aze'; static $stat = 'ic'; } $class = new ReflectionClass('test'); foreach($class->getProperties() as $k => $v){ var_dump($v->getValue(new test())); } ?> instead. Previous Comments: ------------------------------------------------------------------------ [2007-08-17 13:47:01] [EMAIL PROTECTED] Assigned to the maintainer of reflection extension. ------------------------------------------------------------------------ [2007-08-09 15:30:58] vincent dot hoen at gmail dot com Description: ------------ ReflectionProperty::getDefaultValue() returns null only if the property is not static. Reproduce code: --------------- class test{ public $test = 'aze'; static $stat = 'ic'; } $class = new ReflectionClass('test'); foreach($class->getProperties() as $k => $v){ var_dump($v->getValue($class)); } Expected result: ---------------- string 'aze' (length=3) string 'ic' (length=2) Actual result: -------------- null string 'ic' (length=2) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42258&edit=1