On Fri, 19 Sep 2008, Greg Beaver wrote: > Hi all, > > There is a problem in the namespace implementation. This code demonstrates > the issue: > > code.inc: > <?php > namespace foo; > class test { > const my = 1; > static function bar(){} > } > > namespace foo::test; > const my = 2; > function bar(){} > ?> > > main.php: > <?php > include 'code.inc'; > foo::test::bar(); // always calls namespace function > call_user_func(array('foo::test', 'bar')); // the only way to call static > method > echo foo::test::my; // always 2 > $a = new foo::test; > echo $a::my; // the only way to access foo::test::my > ?> > > There are 5 ways to solve this: > > 1) document it and hope no one uses it [this is the current strategy, minus > the documentation part] > 2) add a fatal error on conflicting names.
Uh, if we don't have functions in namespaces, then the second "function bar(){}" would define the bar function in the global scope only and not as part of the foo::test namespace... so one more reason to remove functions (and constants) from namespaces? regards, Derick -- HEAD before 5_3!: http://tinyurl.com/6d2esb http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php