Index: trunk/core/kernel/globals.php =================================================================== diff -u -N -r2328 -r2592 --- trunk/core/kernel/globals.php (.../globals.php) (revision 2328) +++ trunk/core/kernel/globals.php (.../globals.php) (revision 2592) @@ -325,4 +325,40 @@ { function memory_get_usage(){ return -1; } } + + function &ref_call_user_func_array($callable, $args) + { + if( is_scalar($callable) ) + { + // $callable is the name of a function + $call = $callable; + } + else + { + if( is_object($callable[0]) ) + { + // $callable is an object and a method name + $call = "\$callable[0]->{$callable[1]}"; + } + else + { + // $callable is a class name and a static method + $call = "{$callable[0]}::{$callable[1]}"; + } + } + + // Note because the keys in $args might be strings + // we do this in a slightly round about way. + $argumentString = Array(); + $argumentKeys = array_keys($args); + foreach($argumentKeys as $argK) + { + $argumentString[] = "\$args[$argumentKeys[$argK]]"; + } + $argumentString = implode($argumentString, ', '); + // Note also that eval doesn't return references, so we + // work around it in this way... + eval("\$result =& {$call}({$argumentString});"); + return $result; + } ?> \ No newline at end of file