#22501 [Fbk->NoF]: Problem referencing static var of class inside a namespace

From: Date: Tue, 27 May 2003 06:00:01 +0000
Subject: #22501 [Fbk->NoF]: Problem referencing static var of class inside a namespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40478@lists.php.net to get a copy of this message
ID: 22501 Updated by: php-bugs@lists.php.net Reported By: ben at pirionsystems dot com dot au -Status: Feedback +Status: No Feedback Bug Type: Zend Engine 2 problem Operating System: Windows XP PHP Version: 5CVS-2003-03-02 (dev) New Comment: No feedback was provided for this bug for over 2 weeks, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". Previous Comments: ------------------------------------------------------------------------ [2003-05-11 08:29:35] moriyoshi@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-04-18 18:30:40] thekid at thekid dot de 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" ------------------------------------------------------------------------ [2003-03-02 01:48:13] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22501&edit=1

« previous php.bugs (#40478) next »