#50038 [Opn]: PHP doesn't like it when a namespace starts with a number for example 12eggs

From: Date: Fri, 30 Oct 2009 12:08:30 +0000
Subject: #50038 [Opn]: PHP doesn't like it when a namespace starts with a number for example 12eggs
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3025@lists.php.net to get a copy of this message
ID: 50038 Updated by: colder@php.net Reported By: me at gerryevans dot com Status: Open -Bug Type: Unknown/Other Function +Bug Type: Documentation problem Operating System: CentOS PHP Version: 5.3.0 New Comment: namespaces' names follow the same rule as classes/functions' names, which can't start by numbers either. Previous Comments: ------------------------------------------------------------------------ [2009-10-30 10:49:38] me at gerryevans dot com I have tested this error on a CentOS server running Apache 2 + PHP 5.3 and Lighttpd + PHP 5.3. The php.ini both times was a php.ini-production with the only change "expose_php" to Off. ------------------------------------------------------------------------ [2009-10-30 10:35:03] me at gerryevans dot com Description: ------------ PHP doesn't like it when a namespace starts with a number for example a namespace 12eggs will get a parse error ("syntax error, unexpected T_LNUMBER, expecting T_STRING or T_NS_SEPARATOR or '{'"). Reproduce code: --------------- <?php namespace 12eggs; echo __NAMESPACE__; ?> Expected result: ---------------- 12eggs Actual result: -------------- Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_NS_SEPARATOR or '{' in FILE on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50038&edit=1

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