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
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 !
Your email address:
MUST BE VALID
Solve the problem:
39 - 33 = ?
Subscribe to this entry?

 
 [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 05:01:33 2024 UTC