Bug #71416 [Opn]: Reflection for ReflectionMethod::invoke considers second parameter as required
| From: | ondrej at mirtes dot cz | Date: | Tue, 19 Jan 2016 20:37:42 +0000 |
| Subject: | Bug #71416 [Opn]: Reflection for ReflectionMethod::invoke considers second parameter as required | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198776@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
User updated by: ondrej at mirtes dot cz
Reported by: ondrej at mirtes dot cz
Summary: Reflection for ReflectionMethod::invoke considers
second parameter as required
Status: Open
Type: Bug
Package: Reflection related
Operating System: all
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The test script has run here: https://3v4l.org/PXYvm
Previous Comments:
------------------------------------------------------------------------
[2016-01-19 20:36:57] ondrej at mirtes dot cz
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 this bug report at https://bugs.php.net/bug.php?id=71416&edit=1