Hello there
 
I think I found an undocumented behavior in the 'call_user_func' function in PHP version 4.3.1.
 
All arguments are passed by value, even if you call a function that takes its arguments by reference.
 
Here is my example:
 
<?php
 
function createString( &$arg ) {
 $arg = 'Hello World';
}
 
// calling the function normally
 
createString( $stdCall );
echo "<p>'createString($stdCall)' works: '$stdCall'</p>";
 
// calling the function by using a variable as functionname
 
$funcName = 'createString';
$funcName( $varCall );
 
echo "<p>'$func($varCall)' works: '$varCall'</p>";
 
// calling the function by call_user_func
 
call_user_func( 'createString', $userCall );
echo "<p>'call_user_func( 'createString', $userCall )' does not work: '$userCall'</p>";

?>
 
greetings
 
Philipp Benjamin Köpchen

Reply via email to