#43343 [Asn->Csd]: Variable class name

From: Date: Fri, 07 Dec 2007 17:19:12 +0000
Subject: #43343 [Asn->Csd]: Variable class name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120460@lists.php.net to get a copy of this message
ID: 43343 Updated by: dmitry@php.net Reported By: felipensp at gmail dot com -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem PHP Version: 5.3CVS-2007-11-20 (snap) Assigned To: dmitry New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2007-11-24 12:31:48] jani@php.net Another namespace issue. ------------------------------------------------------------------------ [2007-11-20 11:01:13] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43343&edit=1

« previous php.bugs (#120460) next »