xref: /PHP-5.3/Zend/tests/ns_026.phpt (revision 610c7fbe)
1--TEST--
2026: Name ambiguity (class name & namespace name)
3--FILE--
4<?php
5namespace Foo;
6
7class Foo {
8  function __construct() {
9  	echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
10  }
11  static function Bar() {
12  	echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
13  }
14}
15
16function Bar() {
17  echo "Func   - ".__FUNCTION__."\n";
18}
19
20$x = new Foo;
21\Foo\Bar();
22$x = new \Foo\Foo;
23\Foo\Foo::Bar();
24\Foo\Bar();
25Foo\Bar();
26--EXPECTF--
27Method - Foo\Foo::__construct
28Func   - Foo\Bar
29Method - Foo\Foo::__construct
30Method - Foo\Foo::Bar
31Func   - Foo\Bar
32
33Fatal error: Call to undefined function Foo\Foo\Bar() in %sns_026.php on line %d