#38992 [Opn->Asn]: ReflectionMethod::invoke() and ::invokeArgs() static method calls should match
| From: | johannes@php.net | Date: | Sat, 30 Sep 2006 09:59:32 +0000 |
| Subject: | #38992 [Opn->Asn]: ReflectionMethod::invoke() and ::invokeArgs() static method calls should match | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-102916@lists.php.net to get a copy of this message | ||
ID: 38992
Updated by: johannes@php.net
Reported By: matthew at zend dot com
-Status: Open
+Status: Assigned
Bug Type: Feature/Change Request
Operating System: Debian SID on i686
PHP Version: 5.1.6
-Assigned To:
+Assigned To: johannes
Previous Comments:
------------------------------------------------------------------------
[2006-09-29 13:15:51] matthew at zend dot com
Description:
------------
ReflectionMethod::invoke() and ReflectionMethod::invokeArgs()
implementations currently do not support the same functionality.
Currently, ReflectionMethod::invoke() can be called using a string
class name as the first argument *if* the method is declared static.
However, ReflectionMethod::invokeArgs(), called the same way, raises a
warning and does not invoke the method:
Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be
object, string given
Calling with a string class name is undocumented currently, but a
useful feature to have. I'd request that invokeArgs() be made to match
the current invoke() functionality, and the documentation updated to
indicate this usage.
Reproduce code:
---------------
<?php
class MyClass
{
public static function doSomething()
{
echo "Did it!\n";
}
}
$r = new ReflectionMethod('MyClass', 'doSomething');
$args = array();
$r->invoke('MyClass', array());
$r->invokeArgs('MyClass', $args);
Expected result:
----------------
Did it!
Did it!
Actual result:
--------------
Did it!
Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be
object, string given in ... line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38992&edit=1