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

From: Date: Fri, 30 Oct 2009 12:39:09 +0000
Subject: #50038 [Com]: 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-3026@lists.php.net to get a copy of this message
ID: 50038 Comment by: me at gerryevans dot com Reported By: me at gerryevans dot com Status: Open Bug Type: Documentation problem Operating System: CentOS PHP Version: 5.3.0 New Comment: Yep, that make sense. You should include in the PHP docs that the naming rules apply to namespaces, as at the moment their no mention of it. Out of interest, is there any reason why the naming rules doesn't allow the names to start with numbers? Previous Comments: ------------------------------------------------------------------------ [2009-10-30 12:08:30] colder@php.net namespaces' names follow the same rule as classes/functions' names, which can't start by numbers either. ------------------------------------------------------------------------ [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 (#3026) next »