Edit report at http://bugs.php.net/bug.php?id=54105&edit=1
ID: 54105 Updated by: johan...@php.net Reported by: thes...@php.net Summary: namespace names starting with \ should be invalid -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: irrelevant PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php define() does no checking of the name. http://devzone.zend.com/article/475#Heading3 Previous Comments: ------------------------------------------------------------------------ [2011-02-26 13:45:24] thes...@php.net Description: ------------ Defining a namespace who's name starts with a \ is interpreted as a constant though resolving a constant for the namespace name is not supported (and should not! :) ) and results in an empty string being used. Test script: --------------- test.php: <?php define('a','\foo'); require 'a.php'; a.php: <?php namespace \a; var_dump(__NAMESPACE__); class b { } Expected result: ---------------- (Parse?) Error due to invalid namespace definition Actual result: -------------- Empty string for __NAMESPACE__ or undefined constant a depending wheter or not the file "a.php" got required or called directly ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54105&edit=1