#50184 [Tbd->Csd]: Constants can be redefined
| From: | vrana@php.net | Date: | Wed, 25 Nov 2009 10:01:51 +0000 |
| Subject: | #50184 [Tbd->Csd]: Constants can be redefined | ||
| References: | 1 | Groups: | php.bugs php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3336@lists.php.net to get a copy of this message | ||
ID: 50184
Updated by: vrana@php.net
Reported By: goatlabs at gmail dot com
-Status: To be documented
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: OSX 10.6.2; Debian Linux 5.0.3
PHP Version: 5.3.0
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-11-25 09:59:33] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=291296
Log: Case-insensitive are lower-case (bug #50184)
------------------------------------------------------------------------
[2009-11-16 09:35:44] jani@php.net
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)
------------------------------------------------------------------------
[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