Req #67334 [Opn->Nab]: I can change the constant value using define method.

From: Date: Fri, 23 May 2014 15:59:12 +0000
Subject: Req #67334 [Opn->Nab]: I can change the constant value using define method.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185911@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67334&edit=1 ID: 67334 Updated by: aharvey@php.net Reported by: gangadhar dot kasim at gmail dot com Summary: I can change the constant value using define method. -Status: Open +Status: Not a bug Type: Feature/Change Request Package: *General Issues Operating System: Windows PHP Version: 5.4.28 Block user comment: N Private report: N New Comment: 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 This is weird (and certainly a misfeature), but documented: case insensitive constant names are stored in lowercase, so internally, greeting and GREETING are different constants and hence an error isn't generated. Previous Comments: ------------------------------------------------------------------------ [2014-05-23 11:35:17] gangadhar dot kasim at gmail dot com Description: ------------ If I pass the optional third parameter in DEFINE method as TRUE, it is allowing me to override the existing value of a constant. This is not the expected behavior as constant's value should not be changed once it is declared. Test script: --------------- define("GREETING", "Hello you.",true); echo GREETING; // outputs "Hello you." echo "before changing the constant value <br/>"; //before changing the constant value define("GREETING", "sample value."); echo GREETING; // outputs "sample value." echo "<br/>"; Expected result: ---------------- constant's value should not be changed once it is declared. Actual result: -------------- it is allowing me to override the existing value of a constant. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67334&edit=1

« previous php.bugs (#185911) next »