From:             kenashkov at gmail dot com
Operating system: GNU/Linux debian lenny
PHP version:      5.3CVS-2008-10-15 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  define() namespaced constant is case sensitive

Description:
------------
The current implementatino of namespaces is case INSENSITIVE. But defining
a constant using define and having capitals in the namespace makes the
defined constant unreachable.

We can verify this using get_defined_constants(). In case a constant was
defined like:
<?
namespace NS1::ns2;
const const1;
?>
we can see the the defined constant/namespace is in fact:
ns1::ns2::const1;
But if the constant was defined using define(), it is kept with the
capitalization:
<?
define('NS1::ns2::const1','value');
?>
get_defined_constants() gives NS1::ns2::const1.

But because the namespaces are case insensitive the call:
<?
print NS1::ns2::const1;
?>
resolves in fact to ns1::ns2::const1 which is undefined.

Reproduce code:
---------------
<?
define('NS1::ns2::const1','value');
print NS1::ns2::const1;//error
//print ns1::ns2::const1;//would give error too
?>

Expected result:
----------------
value

Actual result:
--------------
Fatal error: Class 'NS1::ns2' not found in /home/local/tests/t35.php on
line 3

-- 
Edit bug report at http://bugs.php.net/?id=46304&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46304&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46304&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46304&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46304&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46304&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46304&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46304&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46304&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46304&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46304&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46304&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46304&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46304&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46304&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46304&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46304&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46304&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46304&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46304&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46304&r=mysqlcfg

Reply via email to