php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74421 Wrong reflection on ReflectionFunction::invoke
Submitted: 2017-04-12 11:32 UTC Modified: 2018-02-23 18:58 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: fabien dot villepinte at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Reflection related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fabien dot villepinte at gmail dot com
New email:
PHP Version: OS:

 

 [2017-04-12 11:32 UTC] 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)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-12 11:35 UTC] 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-17 16:51 UTC] fabien dot villepinte at gmail dot com
I have added the PR to the wrong ticket. Sorry for the disturbance.
 [2018-02-23 18:58 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-02-23 18:58 UTC] cmb@php.net
Actually, this is a duplicate of bug #71416.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC