summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_use_variable_twice.phpt
blob: 06c2645809e17e83ace494ef1585e0f516fdb758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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