summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_019.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/closure_019.phpt')
-rw-r--r--Zend/tests/closure_019.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt
new file mode 100644
index 0000000..0c4c34e
--- /dev/null
+++ b/Zend/tests/closure_019.phpt
@@ -0,0 +1,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