Bug #54105 [Bgs->Opn]: namespace names starting with \ should be invalid

From: Date: Sat, 26 Feb 2011 13:13:25 +0000
Subject: Bug #54105 [Bgs->Opn]: namespace names starting with \ should be invalid
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159061@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54105&edit=1

 ID:                 54105
 Updated by:         johannes@php.net
 Reported by:        theseer@php.net
 Summary:            namespace names starting with \ should be invalid
-Status:             Bogus
+Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   irrelevant
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Reading is hard ... seems valid


Previous Comments:
------------------------------------------------------------------------
[2011-02-26 14:00:01] johannes@php.net

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

------------------------------------------------------------------------
[2011-02-26 13:45:24] theseer@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


Thread (4 messages)

« previous php.bugs (#159061) next »