xref: /PHP-8.0/Zend/tests/bug54358.phpt (revision f8d79582)
1--TEST--
2Bug #54358 (Closure, use and reference)
3--FILE--
4<?php
5class asserter {
6    public function call($function) {
7    }
8}
9
10$asserter = new asserter();
11
12$closure = function() use ($asserter, &$function) {
13        $asserter->call($function = 'md5');
14};
15
16$closure();
17
18var_dump($function);
19
20$closure = function() use ($asserter, $function) {
21        $asserter->call($function);
22};
23
24$closure();
25
26var_dump($function);
27
28$closure = function() use ($asserter, $function) {
29        $asserter->call($function);
30};
31
32$closure();
33
34var_dump($function);
35?>
36--EXPECT--
37string(3) "md5"
38string(3) "md5"
39string(3) "md5"
40