Skip to content

Commit 7c8007f

Browse files
committed
Add test case showing unpinned local functions are not considered existing
1 parent c87e8b7 commit 7c8007f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
function_exist of local function returns false even with global one defined
3+
--FILE--
4+
<?php
5+
namespace {
6+
function loader($name) {
7+
echo "function loader called with $name\n";
8+
}
9+
10+
autoload_register_function('loader');
11+
12+
function bar() {
13+
echo "I am bar in global namespace.\n";
14+
}
15+
}
16+
17+
namespace foo {
18+
if (!function_exists(__NAMESPACE__.'\\bar')) {
19+
function bar() {
20+
echo "I'm bar in foo namespace";
21+
}
22+
}
23+
24+
bar();
25+
}
26+
27+
?>
28+
--EXPECT--
29+
function loader called with foo\function_exists
30+
function loader called with foo\bar
31+
I'm bar in foo namespace

0 commit comments

Comments
 (0)