Bug #74421 [Com]: Wrong reflection on ReflectionFunction::invoke

From: Date: Wed, 12 Apr 2017 11:35:22 +0000
Subject: Bug #74421 [Com]: Wrong reflection on ReflectionFunction::invoke
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208490@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74421&edit=1 ID: 74421 Comment by: fabien dot villepinte at gmail dot com Reported by: fabien dot villepinte at gmail dot com Summary: Wrong reflection on ReflectionFunction::invoke Status: Open Type: Bug Package: Reflection related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I think this bug is related to this issue: https://bugs.php.net/bug.php?id=71416 Previous Comments: ------------------------------------------------------------------------ [2017-04-12 11:32:38] fabien dot villepinte at gmail dot com Description: ------------ The method ReflectionFunction::invoke has one parameter which is variadic ( http://php.net/manual/en/reflectionfunction.invoke.php ), but by reflection the method and its parameter are described as non-variadic. Here a portion of code showing the method accepts a variadic parameter: <?php class Foo { public function concat($var1, $var2) { return $var1.$var2; } } $r = new ReflectionMethod('Foo', 'concat'); $args = ['Hello ', 'world!']; echo $r->invoke(new Foo(), ...$args);// prints "Hello world!" Test script: --------------- <?php $rf = new ReflectionMethod(ReflectionFunction::class, 'invoke'); var_dump($rf->isVariadic()); var_dump($rf->getParameters()[0]->isVariadic()); Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(false) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74421&edit=1

« previous php.bugs (#208490) next »