ID: 29523 Updated by: [EMAIL PROTECTED] Reported By: Jared dot Williams1 at ntlworld dot com -Status: Open +Status: Closed Bug Type: Class/Object related Operating System: * PHP Version: 5.1.0-dev Assigned To: helly New Comment:
Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Previous Comments: ------------------------------------------------------------------------ [2004-08-04 14:02:40] Jared dot Williams1 at ntlworld dot com Description: ------------ ReflectionParameter::isOptional() does not return the correct optional status of some parameters. ReflectionFunction::getNumberOfRequiredParameters() returns the current number of required parameters, but when iterator through the ReflectionFunction::getParamaters() counting parameters that are not marked as optional, the value calculated is incorrect. Reproduce code: --------------- class TestClass { } function optionalTest(TestClass $a, TestClass $b, $c = 3) { } $function = new ReflectionFunction('optionalTest'); $numberOfNotOptionalParameters = 0; $numberOfOptionalParameters = 0; foreach($function->getParameters() as $parameter) if ($parameter->isOptional()) ++$numberOfOptionalParameters; else ++$numberOfNotOptionalParameters; var_dump($function->getNumberOfRequiredParameters()); var_dump($numberOfNotOptionalParameters); Expected result: ---------------- int(2) int(2) Actual result: -------------- int(2) int(0) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29523&edit=1