xref: /PHP-5.6/Zend/tests/closure_019.phpt (revision fcb98cbc)
1--TEST--
2Closure 019: Calling lambda using $GLOBALS and global $var
3--FILE--
4<?php
5
6$lambda = function &(&$x) {
7	return $x = $x * $x;
8};
9
10function test() {
11	global $lambda;
12
13	$y = 3;
14	var_dump($GLOBALS['lambda']($y));
15	var_dump($lambda($y));
16	var_dump($GLOBALS['lambda'](1));
17}
18
19test();
20
21?>
22--EXPECTF--
23Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
24int(9)
25
26Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
27int(81)
28
29Fatal error: Cannot pass parameter 1 by reference in %s on line %d
30