note 100951 deleted from reflectionmethod.invokeargs by thiago

From: Date: Tue, 16 Nov 2010 20:13:13 +0000
Subject: note 100951 deleted from reflectionmethod.invokeargs by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174102@lists.php.net to get a copy of this message
Note Submitter: contato at andersonfraga dot net ---- <?php class Test { public function methodHere($arg1, $arg2, $arg3) { echo '<pre>'; echo 'arg1: ' . $arg1 . PHP_EOL; echo 'arg2: ' . $arg2 . PHP_EOL; echo 'arg3: ' . $arg3 . PHP_EOL; // print arg4... :( echo '</pre>'; } } $ref_test = new ReflectionClass('Test'); $ref_method = $ref_test->getMethod('methodHere'); $list_args = Array( 'arg2' => 'apple', // ok! 'arg1' => 'wine', // ok! 'arg4' => 'thats all folks!', // what? arg4?? And arg3?? ); $ref_method->invokeArgs(new Test(), $list_args); /* result: arg1: apple arg2: wine arg3: thats all folks! */ ?> I think this result is not correct. It should not obey the parameter names?

« previous php.notes (#174102) next »