2008-07-14 13:39:32 +00:00
|
|
|
--TEST--
|
|
|
|
Closure 019: Calling lambda using $GLOBALS and global $var
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$lambda = function &(&$x) {
|
|
|
|
return $x = $x * $x;
|
|
|
|
};
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
global $lambda;
|
|
|
|
|
|
|
|
$y = 3;
|
|
|
|
var_dump($GLOBALS['lambda']($y));
|
|
|
|
var_dump($lambda($y));
|
|
|
|
var_dump($GLOBALS['lambda'](1));
|
|
|
|
}
|
|
|
|
|
|
|
|
test();
|
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
2013-11-27 16:30:35 +00:00
|
|
|
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
2008-07-14 13:39:32 +00:00
|
|
|
int(9)
|
2013-11-27 16:30:35 +00:00
|
|
|
|
|
|
|
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
2008-07-14 13:39:32 +00:00
|
|
|
int(81)
|
|
|
|
|
2015-05-17 22:31:43 +00:00
|
|
|
Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
|
2015-05-15 19:04:07 +00:00
|
|
|
Stack trace:
|
|
|
|
#0 %s(%d): test()
|
|
|
|
#1 {main}
|
|
|
|
thrown in %s on line %d
|