|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-01 15:22 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 06:00:01 2025 UTC |
Description: ------------ The definition for ReflectionMethod::invokeArgs() indicates that it takes an array as its 2nd argument. I assume this array is then passed to the method being reflected, however it is not. -- Additionally, if I use type hinting in the reflected method, (e.g. public function callMe(array $args)) the script terminates with a fatal error. Reproduce code: --------------- <?php class MyClass { public static function test() { $obj = new MyClass(); $ro = new ReflectionObject($obj); $rm = $ro->getMethod("callMe"); $args = array("key1" => "value1", "key2" => "value2", "key3" => "value3"); print_r($args); $rm->invokeArgs($obj, $args); } public function callMe($args) { print_r($args); } } MyClass::test(); ?> Expected result: ---------------- Array ( [key1] => value1 [key2] => value2 [key3] => value3 ) Array ( [key1] => value1 [key2] => value2 [key3] => value3 ) Actual result: -------------- Array ( [key1] => value1 [key2] => value2 [key3] => value3 ) value1