php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43343 Variable class name
Submitted: 2007-11-20 11:01 UTC Modified: 2007-12-07 17:19 UTC
From: felipensp at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-11-20 (snap) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [2007-11-20 11:01 UTC] felipensp at gmail dot com
Description:
------------
See the code below.

Reproduce code:
---------------
<?php

namespace foobar;

class foo { }

//var_dump(namespace::);
// Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '$'

// Ok!

$foo = 'foo';

var_dump(new namespace::$foo);
// Fatal error: Class 'foobar' not found 

// var_dump(new namespace::foo); # Ok!

Expected result:
----------------
var_dump(namespace::);
Parse error: syntax error, unexpected ')', expecting T_STRING

or

Support the variable referencing class name.

Actual result:
--------------
Fatal error: Class 'foobar' not found 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-24 12:31 UTC] jani@php.net
Another namespace issue.
 [2007-12-07 17:19 UTC] dmitry@php.net
The syntax A::$foo assumes static property of class A.
The syntax namespace::$foo makes no sense as namespaces cannot contain variables.

The current version emits error message:

Fatal error: Cannot use 'namespace' as a class name
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC