6f4b1c76a8
We can't box a non-ref value for a ref param because
we could be modifying an array with refCount != 1.
zend warns, skips the call and returns null. For now, this
makes us warn, but do the call (without modifying the array).
A file scope flag controls whether to skip the call or not,
and should be changed (and eliminated) once all our tests pass.
With the flag turned on, we still dont match zend's behavior,
because its happy to go ahead and call the function with no
warning in the case of a literal array parameter
(cuf('foo', array(1))), even though it warns and skips it when
the array is in a variable ($a=array(1); cuf('foo', $a)).
16 linhas
359 B
PHP
16 linhas
359 B
PHP
<?php
|
|
error_reporting(-1);
|
|
function foo(&$a) { var_dump($a++); }
|
|
function test($cuf, $f) {
|
|
$a = array(1);
|
|
$cuf($f, $a);
|
|
var_dump($a, array(1));
|
|
$cuf($f, array(1));
|
|
var_dump($a, array(1));
|
|
call_user_func_array($f, $a);
|
|
var_dump($a, array(1));
|
|
call_user_func_array($f, array(1));
|
|
var_dump($a, array(1));
|
|
}
|
|
test('call_user_func_array', 'foo');
|