summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_019.phpt
blob: 0c4c34e163c5006d5068b911ab823195188c9040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--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