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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC