ID: 33312 Updated by: [EMAIL PROTECTED] Reported By: sb at sebastian-bergmann dot de Status: Closed Bug Type: Zend Engine 2 problem Operating System: Windows XP PHP Version: 5CVS-2005-06-11 (dev) -Assigned To: +Assigned To: dmitry New Comment:
Fixed in CVS HEAD. Previous Comments: ------------------------------------------------------------------------ [2005-06-13 10:43:07] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2005-06-11 16:03:12] sb at sebastian-bergmann dot de Description: ------------ The ReflectionParameter::isDefaultValueAvailable() and ReflectionParameter::getDefaultValue() methods only work correctly when the method only has one parameter. When the method has more than one parameter, ReflectionParameter::isDefaultValueAvailable() returns FALSE for a parameter that has a default value and ReflectionParameter::getDefaultValue() produces an error when trying to access the default value. The reproducing script below works fine with the current PHP_5_0 branch. With HEAD it prints nothing. Only after removing "Foo $foo, " from the method signature does it print "bar". Reproduce code: --------------- <?php class Foo { public function bar(Foo $foo, $bar = 'bar') { } } $class = new ReflectionClass('Foo'); $method = $class->getMethod('bar'); foreach ($method->getParameters() as $parameter) { if ($parameter->isDefaultValueAvailable()) { print $parameter->getDefaultValue(); } } ?> Expected result: ---------------- bar ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33312&edit=1