mirror of
https://github.com/php/php-src.git
synced 2025-01-25 13:14:22 +08:00
27 lines
387 B
Plaintext
27 lines
387 B
Plaintext
|
--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--
|
||
|
int(9)
|
||
|
int(81)
|
||
|
|
||
|
Fatal error: Cannot pass parameter 1 by reference in %s on line %d
|