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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 09 08:01:24 2021 UTC