#49982 [Opn]: Inclusion of token/syntax keyword in namespace causes Parse error

From: Date: Sat, 24 Oct 2009 02:00:09 +0000
Subject: #49982 [Opn]: Inclusion of token/syntax keyword in namespace causes Parse error
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2997@lists.php.net to get a copy of this message
ID: 49982 Updated by: johannes@php.net Reported By: swquinn at gmail dot com Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem Operating System: Windows XP Professional PHP Version: 5.3.0 New Comment: This is expected. Didn't check the docs, maybe this can be made clearer. Previous Comments: ------------------------------------------------------------------------ [2009-10-24 01:34:07] swquinn at gmail dot com Description: ------------ Using a PHP language token, or syntactic keyword within a namespace causes a Parse error to be thrown by PHP. There is no documentation anywhere (that I could find) indicating whether keywords are permitted as part of a namespace name. If they are not, it would be nice if this is documented. If they should be, then this is clearly a defect. It would be _nice_ a keyword could contain any words (language syntax or otherwise). Reproduce code: --------------- <?php namespace my\default\ns; class Foo { public function bar() { return 0; } } $foo = new Foo(); echo $foo->bar(); ?> Expected result: ---------------- 0 Actual result: -------------- Parse error: syntax error, unexpected T_DEFAULT, expecting T_STRING in D:\PHP\tests\test.php on line 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49982&edit=1

« previous php.doc.bugs (#2997) next »