|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-02 01:48 UTC] ben at pirionsystems dot com dot au
Hi!
I've found an odd problem that looks like just a problem with the parser syntax. The following example will show it:
<?php
namespace Test:Test2 {
class Test3 {
static $blah = "qwerty";
}
}
// this works as expected by printing out "qwerty";
print "Test:Test2::Test3::\$blah: ".Test:Test2::Test3::$blah."<br>\n";
namespace Test4 {
class Test5 {
static $blah = "asdf";
}
}
// this causes a parse error: unexpected T_PAAMAYIM_NEKUDOTAYIM
print "Test4::Test5::\$blah: ".Test4::Test5::$blah."<br>\n";
?>
So, if the namespace name has a : in it, then you can reference variables within a class contained within the namespace, otherwise you can't. So, assuming that the : doesn't do anything special, it looks like a problem with the flex/yacc/whatever it is parser and the engine should cope with it.
I think that's everything.
Ben
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 17:00:02 2025 UTC |
Cannot reproduce with current PHP5: thekid@friebes:~/devel/php/php5 > cat | php5 <?php namespace Foo { class Bar { static $x= 'y'; } } var_dump(Foo::Bar::$x); ?> string(1) "y"