forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnamespace_004.phpt
More file actions
74 lines (67 loc) · 1.16 KB
/
namespace_004.phpt
File metadata and controls
74 lines (67 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--TEST--
Allow defining FCC in const expressions in a namespace with function matching a global function later.
--SKIPIF--
<?php
if (function_exists('opcache_get_status')) {
die('skip not for opcache');
}
?>
--FILE--
<?php
namespace Foo;
function foo(\Closure $c = strrev(...)) {
$d = strrev(...);
var_dump($c);
var_dump($c("abc"));
var_dump($d);
var_dump($d("abc"));
}
foo();
if (random_int(1, 2) > 0) {
function strrev(string $value) {
return 'not the global one';
}
}
foo();
?>
--EXPECTF--
object(Closure)#%d (2) {
["function"]=>
string(6) "strrev"
["parameter"]=>
array(1) {
["$string"]=>
string(10) "<required>"
}
}
string(3) "cba"
object(Closure)#%d (2) {
["function"]=>
string(6) "strrev"
["parameter"]=>
array(1) {
["$string"]=>
string(10) "<required>"
}
}
string(3) "cba"
object(Closure)#%d (2) {
["function"]=>
string(6) "strrev"
["parameter"]=>
array(1) {
["$string"]=>
string(10) "<required>"
}
}
string(3) "cba"
object(Closure)#%d (2) {
["function"]=>
string(6) "strrev"
["parameter"]=>
array(1) {
["$string"]=>
string(10) "<required>"
}
}
string(3) "cba"