|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22501 Problem referencing static var of class inside a namespace
Submitted: 2003-03-02 01:48 UTC Modified: 2003-05-27 01:00 UTC
From: ben at pirionsystems dot com dot au Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5CVS-2003-03-02 (dev) OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
40 - 26 = ?
Subscribe to this entry?

 [2003-03-02 01:48 UTC] ben at pirionsystems dot com dot au

I've found an odd problem that looks like just a problem with the parser syntax.  The following example will show it:


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.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-18 18:30 UTC] thekid at thekid dot de
Cannot reproduce with current PHP5:

thekid@friebes:~/devel/php/php5 > cat | php5
  namespace Foo {
    class Bar {
      static $x= 'y';

string(1) "y"
 [2003-05-27 01:00 UTC] php-bugs at lists dot php dot net
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".
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 17:05:49 2023 UTC