php-src/Zend/tests/closure_use_variable_twice.phpt
Nikita Popov 35662c9bd3 Forbid double use() and use() of param
Also commit a test I forgot to add for forbidden use() of
auto-globals.
2016-01-12 15:37:39 +01:00

16 lines
215 B
PHP

--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