php-src/Zend/tests/closure_019.phpt
2013-11-27 21:04:00 +04:00

30 lines
580 B
PHP

--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--
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(9)
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(81)
Fatal error: Cannot pass parameter 1 by reference in %s on line %d