note 100950 added to reflectionmethod.invokeargs
| From: | contato at andersonfraga dot net | Date: | Tue, 16 Nov 2010 20:11:30 +0000 |
| Subject: | note 100950 added to reflectionmethod.invokeargs | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174099@lists.php.net to get a copy of this message | ||
<?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?
----
Server IP: 187.16.23.128
Probable Submitter: 200.143.116.14
----
Manual Page -- http://www.php.net/manual/en/reflectionmethod.invokeargs.php
Edit -- https://master.php.net/note/edit/100950
Del: integrated -- https://master.php.net/note/delete/100950/integrated
Del: useless -- https://master.php.net/note/delete/100950/useless
Del: bad code -- https://master.php.net/note/delete/100950/bad+code
Del: spam -- https://master.php.net/note/delete/100950/spam
Del: non-english -- https://master.php.net/note/delete/100950/non-english
Del: in docs -- https://master.php.net/note/delete/100950/in+docs
Del: other reasons-- https://master.php.net/note/delete/100950
Reject -- https://master.php.net/note/reject/100950
Search -- https://master.php.net/manage/user-notes.php