Bug #71416 [Opn->Nab]: Reflection for ReflectionMethod::invoke considers second parameter as required
| From: | krakjoe@php.net | Date: | Tue, 02 Feb 2016 11:57:24 +0000 |
| Subject: | Bug #71416 [Opn->Nab]: Reflection for ReflectionMethod::invoke considers second parameter as required | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199002@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: krakjoe@php.net
Reported by: ondrej at mirtes dot cz
Summary: Reflection for ReflectionMethod::invoke considers
second parameter as required
-Status: Open
+Status: Not a bug
Type: Bug
Package: Reflection related
Operating System: all
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You appear to be looking at the HHVM output, the PHP output is consistent across all the versions we
care about.
Previous Comments:
------------------------------------------------------------------------
[2016-01-19 20:37:41] ondrej at mirtes dot cz
The test script has run here: https://3v4l.org/PXYvm
------------------------------------------------------------------------
[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