php-src/Zend/tests/call_user_func_006.phpt
Nikita Popov fafe01b07b Make call_user_func() on reference args consistent
Previously reference arguments were allowed if call_user_func()
was compiled to SEND_USER and not otherwise. Make it consistent
by always forbidding them.
2016-06-28 20:43:38 +02:00

29 lines
483 B
PHP

--TEST--
call_user_func() should error on reference arguments
--FILE--
<?php
namespace Foo;
function bar(&$ref) {
$ref = 24;
}
$x = 42;
$ref =& $x;
\call_user_func('Foo\bar', $x);
var_dump($x);
$y = 42;
$ref =& $y;
call_user_func('Foo\bar', $y);
var_dump($y);
?>
--EXPECTF--
Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
int(42)
Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
int(42)