php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42819 self:: resolves to namespace
Submitted: 2007-10-01 19:07 UTC Modified: 2007-10-02 08:55 UTC
From: bs@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2007-10-01 (CVS) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bs@php.net
New email:
PHP Version: OS:

 

 [2007-10-01 19:07 UTC] bs@php.net
Description:
------------
PHP searches for a class named foo when accessing "self::", without the E_NOTICE this script works as expected

Reproduce code:
---------------
<?php
namespace foo;
class Bar {

    static protected
        $foo = array(
            E_NOTICE => 'foo'
        ),
        $bang = 'bang';

    static public function baz() {
        echo self::$bang;
    }

}

foo::Bar::baz();

Expected result:
----------------
bang

Actual result:
--------------
Fatal error: Class 'foo' not found in ... on line 12

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-01 19:10 UTC] johannes@php.net
I can verify the bug, Dmitry please take a look at it, thanks.
 [2007-10-02 08:55 UTC] dmitry@php.net
The bug wasn't rerated to self:: but to conflict between constant indexes and namespaces. It is fixed in CVS HEAD and PHP_5_3.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 08:01:30 2025 UTC