From:             matthew at zend dot com
Operating system: Debian SID on i686
PHP version:      5.1.6
PHP Bug Type:     Feature/Change Request
Bug description:  ReflectionMethod::invoke() and ::invokeArgs() static method 
calls should match

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 bug report at http://bugs.php.net/?id=38992&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38992&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38992&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38992&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38992&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38992&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38992&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38992&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38992&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38992&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38992&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38992&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38992&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38992&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38992&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38992&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38992&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38992&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38992&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38992&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38992&r=mysqlcfg

Reply via email to