Bug #74421 [Opn->Csd]: Wrong reflection on ReflectionFunction::invoke

From: Date: Fri, 23 Feb 2018 18:58:54 +0000
Subject: Bug #74421 [Opn->Csd]: Wrong reflection on ReflectionFunction::invoke
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214089@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74421&edit=1

 ID:                 74421
 Updated by:         cmb@php.net
 Reported by:        fabien dot villepinte at gmail dot com
 Summary:            Wrong reflection on ReflectionFunction::invoke
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Reflection related
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Actually, this is a duplicate of bug #71416.


Previous Comments:
------------------------------------------------------------------------
[2017-04-17 16:51:31] fabien dot villepinte at gmail dot com

I have added the PR to the wrong ticket. Sorry for the disturbance.

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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74421&edit=1


Thread (4 messages)

« previous php.bugs (#214089) next »