ID:               50184
 Updated by:       j...@php.net
 Reported By:      goatlabs at gmail dot com
-Status:           Open
+Status:           To be documented
-Bug Type:         *Programming Data Structures
+Bug Type:         Scripting Engine problem
 Operating System: OSX 10.6.2; Debian Linux 5.0.3
 PHP Version:      5.3.0
 New Comment:

>From manual notes:

A note on redefining:

Constants can't be redefined:

$ php -r "define('A', 1); var_dump('A'); define('A', 2);
var_dump('A');";
string(1) "A"
PHP Notice:  Constant A already defined in Command line code on line 1
string(1) "A"

But using the case insensitive setting shows that the internal
representation is lower case:

$ php -r "define('A', 1, true); var_dump('A'); define('A', 2);
var_dump('A');";
string(1) "A"
string(1) "A"

Note the lower case 'a' in the second define() here:
$ php -r "define('A', 1, true); var_dump('A'); define('a', 2);
var_dump('A');";
string(1) "A"
PHP Notice:  Constant a already defined in Command line code on line 1
string(1) "A"

(Short version: Yes, but no)


Previous Comments:
------------------------------------------------------------------------

[2009-11-16 03:59:24] goatlabs at gmail dot com

Note: the description should read:

define() constants can be modified if originally defined
"case-INsensitive"

------------------------------------------------------------------------

[2009-11-16 01:44:49] goatlabs at gmail dot com

Description:
------------
define() constants can be modified if originally defined case-sensitive

Reproduce code:
---------------
define('TEST', 'foo', true);
var_dump(TEST);
define('TEST', 'bar');
var_dump(TEST);





Expected result:
----------------
string(3) "foo"
string(3) "foo"

Actual result:
--------------
string(3) "foo"
string(3) "bar"



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50184&edit=1

Reply via email to