/usr/share/php/PHP/Compat/Function/call_user_func_array.php is in php-compat 1.6.0a3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <?php
/**
* Replace call_user_func_array()
*
* @category PHP
* @package PHP_Compat
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>
* @link http://php.net/function.call_user_func_array
* @author Aidan Lister <aidan@php.net>
* @version $Revision: 269597 $
* @since PHP 4.0.4
* @require PHP 4.0.0 (user_error)
*/
function php_compat_call_user_func_array($function, $param_arr)
{
$param_arr = array_values((array) $param_arr);
// Sanity check
if (!is_callable($function)) {
if (is_array($function) && count($function) > 2) {
$function = $function[0] . '::' . $function[1];
}
$error = sprintf('call_user_func_array() First argument is expected ' .
'to be a valid callback, \'%s\' was given', $function);
user_error($error, E_USER_WARNING);
return;
}
// Build argument string
$arg_string = '';
$comma = '';
for ($i = 0, $x = count($param_arr); $i < $x; $i++) {
$arg_string .= $comma . "\$param_arr[$i]";
$comma = ', ';
}
// Determine method of calling function
$retval = null;
if (is_array($function)) {
$object =& $function[0];
$method = $function[1];
// Static vs method call
if (is_string($function[0])) {
eval("\$retval = $object::\$method($arg_string);");
} else {
eval("\$retval = \$object->\$method($arg_string);");
}
} else {
eval("\$retval = \$function($arg_string);");
}
return $retval;
}
// Define
if (!function_exists('call_user_func_array')) {
function call_user_func_array($function, $param_arr)
{
return php_compat_call_user_func_array($function, $param_arr);
}
}
|