|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-15 21:30 UTC] diego dot bindart at gmail dot com
-Summary: Fetching constant value triggers inconsistent
behaviour
+Summary: Fetching the value of a constant triggers
inconsistent behaviour
[2017-04-15 21:30 UTC] diego dot bindart at gmail dot com
[2017-04-15 21:37 UTC] nikic@php.net
[2017-04-15 21:44 UTC] nikic@php.net
[2021-10-04 17:09 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2021-10-04 17:09 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Description: ------------ I define a constant as case-insenstive and then define a capitalization variation of the same constant. In between defines I echo the value of the constant *using the case-sensitive capitalization*. In the CLI it works as expected, but testing in the apache server gives me the right anser only once, and then a different answers on succesive page reloads. The same happens if instead of echoing I assign the constant value to a variable (e.g. $var = SOME_CONST). Tested on Chrome, Opera and Firefox, using Apache 2.4.18 Ubuntu. Steps to reproduce: * execute the code below, as given, in a web server. You should get (as expected): 12 * reload the page (might need to do this several times) and you get instead: 11 ---------------- Other things to note that I tested: * it works as expected in the command line * if you don't echo SOME_CONST before defining the case-sensitive variation, it works as expected * if you echo SOME_const (or any other capitalization variation) there's no bug either * sometimes it needs one reload and sometimes many (never more than 3 or 4, though) * after you get the bug, comment the first echo and you'll get the right result again; remove the comment and you get the bug again after few reloads * if I print the defined constants I see both constants with the right values (namely 1 and 2) Test script: --------------- define('sOmE_CoNsT', 1, true); echo SOME_CONST; // Prints 1 define('SOME_CONST', 2); echo SOME_CONST; // Prints 2 Expected result: ---------------- Consistently prints "12" on successive page loads Actual result: -------------- Prints "12" the first few times, then "11" on successive page reloads