From: denvil at gmail dot com Operating system: Mac OS X Lion PHP version: 5.3.13 Package: Reflection related Bug Type: Feature/Change Request Bug description:ReflectionMethod::__construct should carry the object reference if supplied
Description: ------------ Please let me know if I have misunderstood the whole idea behind the reflections. I use callbacks in my code a lot, and they are good when I use call_user_func_array() along with array($object, $method) as the argument. This makes abstraction and normalizing handler classes very easily. But I found this code pattern difficult to port to the reflections, as long as there is nowhere I can pass the method along with the reference of that particular object in the reflection class. Imagined scenario as follow, ``` $object = new MyHandler($initialize_options); $callback = new ReflectionMethod($object, 'handleResult'); $net->request($parameters, $callback); ``` Expected result: ---------------- ReflectionMethod::invoke() and ReflectionMethod::invokeArgs() should have their first parameter remains optional, but calls a non-static method even when NULL is specified in case an object instance is provided in ReflectionMethod::__construct(). Actual result: -------------- ReflectionMethod::invokeArgs() takes the first parameter as the object reference, static method is assumed if the first parameter is omitted (NULL). -- Edit bug report at https://bugs.php.net/bug.php?id=62178&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62178&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62178&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62178&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62178&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62178&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62178&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62178&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62178&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62178&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62178&r=support Expected behavior: https://bugs.php.net/fix.php?id=62178&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62178&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62178&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62178&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62178&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62178&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62178&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62178&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62178&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62178&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62178&r=mysqlcfg