summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_use_variable_twice.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/closure_use_variable_twice.phpt')
-rw-r--r--Zend/tests/closure_use_variable_twice.phpt15
1 files changed, 15 insertions, 0 deletions
diff --git a/Zend/tests/closure_use_variable_twice.phpt b/Zend/tests/closure_use_variable_twice.phpt
new file mode 100644
index 0000000000..06c2645809
--- /dev/null
+++ b/Zend/tests/closure_use_variable_twice.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Closure cannot use one variable twice
+--FILE--
+<?php
+
+$a = 1;
+$fn = function() use ($a, &$a) {
+ $a = 2;
+};
+$fn();
+var_dump($a);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use variable $a twice in %s on line %d