Bug #71416 [Opn->Ana]: Reflection for ReflectionMethod::invoke considers second parameter as required

From: Date: Fri, 14 Apr 2017 09:26:50 +0000
Subject: Bug #71416 [Opn->Ana]: Reflection for ReflectionMethod::invoke considers second parameter as required
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208543@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71416&edit=1 ID: 71416 Updated by: cmb@php.net Reported by: ondrej at mirtes dot cz Summary: Reflection for ReflectionMethod::invoke considers second parameter as required -Status: Open +Status: Analyzed Type: Bug Package: Reflection related Operating System: all PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The arginfo[1] is obviously wrong. We need ZEND_BEGIN_ARG_INFO_EX() here. [1] <https://github.com/php/php-src/blob/php-7.1.4/ext/reflection/php_reflection.c#L6421-L6424> Previous Comments: ------------------------------------------------------------------------ [2016-12-22 17:51:01] rquadling@php.net Reopening. ------------------------------------------------------------------------ [2016-12-22 17:46:43] rquadling@php.net The reflection of the ReflectionMethod::invoke is certainly NOT in keeping with the documentation. Running: php --rc ReflectionMethod and then looking at the invoke() method shows ... Method [ <internal:Reflection> public method invoke ] { - Parameters [2] { Parameter #0 [ <required> $object ] Parameter #1 [ <required> $args ] } } Not HHVM. Not any PHP script. Just PHP. ------------------------------------------------------------------------ [2016-02-03 08:15:18] ondrej at mirtes dot cz I am not talking about HHVM at all. I am comparing PHP documentation and the current production behaviour to what PHP reflection reports. I haven't mentioned HHVM even once. ------------------------------------------------------------------------ [2016-02-03 08:07:05] a at b dot c dot de The HipHop Virtual Machine is a Facebook product, not something built by php.net. It's not the place of the official PHP manual to describe differences in third-party implementations/variants. ------------------------------------------------------------------------ [2016-02-02 12:06:21] ondrej at mirtes dot cz I still think it's a bug, because the PHP reflection (in versions from 5.6.0 to 7.0.2) returns that the second parameter is not optional (so it's required) and that it's not variadic. But according to the documentation of the method (https://secure.php.net/manual/en/reflectionmethod.invoke.php), it can be invoked with only just one parameter - the object. As the method can be invoked with 1 to infinite number of parameters, I think the reflection of this method reports wrong information. I already reported two inconsistencies in PHP reflection (https://bugs.php.net/bug.php?id=71077, https://bugs.php.net/bug.php?id=70960) which were acknowledged and fixed so I think this case is another of such inconsistencies. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=71416 -- Edit this bug report at https://bugs.php.net/bug.php?id=71416&edit=1

« previous php.bugs (#208543) next »