Bug #71416 [NEW]: Reflection for ReflectionMethod::invoke considers second parameter as required

From: Date: Tue, 19 Jan 2016 20:36:58 +0000
Subject: Bug #71416 [NEW]: Reflection for ReflectionMethod::invoke considers second parameter as required
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198775@lists.php.net to get a copy of this message
From: ondrej at mirtes dot cz Operating system: all PHP version: Irrelevant Package: Reflection related Bug Type: Bug Bug description:Reflection for ReflectionMethod::invoke considers second parameter as required Description: ------------ ReflectionMethod::invoke accepts one required parameter (the object) and then zero or more parameters that should be passed to the invoked method as stated in the documentation: https://secure.php.net/manual/en/reflectionmethod.invoke.php But the reported parameters by reflection are not consistent with that. It does not consider the second parameter as variadic and it considers it as required. I expect the second parameter to be reported as optional and as variadic. Test script: --------------- <?php $ref = new ReflectionClass('ReflectionMethod'); foreach ($ref->getMethod('invoke')->getParameters() as $parameter) { var_dump($parameter->getName()); var_dump($parameter->isOptional()); var_dump($parameter->isVariadic()); var_dump('---'); } Expected result: ---------------- string(6) "object" bool(false) bool(false) string(3) "---" string(4) "args" bool(true) bool(true) string(3) "---" Actual result: -------------- string(6) "object" bool(false) bool(false) string(3) "---" string(4) "args" bool(false) bool(false) string(3) "---" -- Edit bug report at https://bugs.php.net/bug.php?id=71416&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71416&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71416&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71416&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71416&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71416&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71416&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71416&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71416&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71416&r=support Expected behavior: https://bugs.php.net/fix.php?id=71416&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71416&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71416&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71416&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71416&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71416&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71416&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71416&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71416&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71416&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71416&r=mysqlcfg

« previous php.bugs (#198775) next »