File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed
Zend/tests/closure_const_expr/fcc Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Allow defining FCC in const expressions in a namespace with function matching a global function later.
3+ --FILE--
4+ <?php
5+
6+ namespace Foo ;
7+
8+ function foo (\Closure $ c = strrev (...)) {
9+ $ d = strrev (...);
10+ var_dump ($ c );
11+ var_dump ($ c ("abc " ));
12+ var_dump ($ d );
13+ var_dump ($ d ("abc " ));
14+ }
15+
16+
17+ foo ();
18+
19+ if (random_int (1 , 2 ) > 0 ) {
20+ function strrev (string $ value ) {
21+ return 'not the global one ' ;
22+ }
23+ }
24+
25+ foo ();
26+
27+ ?>
28+ --EXPECTF--
29+ object(Closure)#1 (2) {
30+ ["function"]=>
31+ string(6) "strrev"
32+ ["parameter"]=>
33+ array(1) {
34+ ["$string"]=>
35+ string(10) "<required>"
36+ }
37+ }
38+ string(3) "cba"
39+ object(Closure)#2 (2) {
40+ ["function"]=>
41+ string(6) "strrev"
42+ ["parameter"]=>
43+ array(1) {
44+ ["$string"]=>
45+ string(10) "<required>"
46+ }
47+ }
48+ string(3) "cba"
49+ object(Closure)#2 (2) {
50+ ["function"]=>
51+ string(10) "strrev"
52+ ["parameter"]=>
53+ array(1) {
54+ ["$string"]=>
55+ string(10) "<required>"
56+ }
57+ }
58+ string(18) "cba"
59+ object(Closure)#1 (2) {
60+ ["function"]=>
61+ string(6) "strrev"
62+ ["parameter"]=>
63+ array(1) {
64+ ["$string"]=>
65+ string(10) "<required>"
66+ }
67+ }
68+ string(3) "cba"
You can’t perform that action at this time.
0 commit comments