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

From: Date: Mon, 17 Apr 2017 16:51:33 +0000
Subject: Bug #74421 [Opn]: Wrong reflection on ReflectionFunction::invoke
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208624@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 User updated 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 have added the PR to the wrong ticket. Sorry for the disturbance. Previous Comments: ------------------------------------------------------------------------ [2017-04-12 11:35:20] fabien dot villepinte at gmail dot com I think this bug is related to this issue: https://bugs.php.net/bug.php?id=71416 ------------------------------------------------------------------------ [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 (#208624) next »