Bug #54105 [NEW]: namespace names starting with \ should be invalid

From: Date: Sat, 26 Feb 2011 12:45:24 +0000
Subject: Bug #54105 [NEW]: namespace names starting with \ should be invalid
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159059@lists.php.net to get a copy of this message
From:             theseer
Operating system: irrelevant
PHP version:      5.3.5
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:namespace names starting with \ should be invalid

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 bug report at http://bugs.php.net/bug.php?id=54105&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=54105&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=54105&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=54105&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=54105&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54105&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=54105&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=54105&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=54105&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=54105&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=54105&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=54105&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=54105&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=54105&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=54105&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54105&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54105&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=54105&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=54105&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=54105&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=54105&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=54105&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#159059) next »