|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-26 22:27 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 03:00:01 2025 UTC |
Description: ------------ Whenever you compare strings of the format "1D-XXXX" where XXXX is any number between 4950 and 5201, they will always return true. For example "1D-5155" == "1D-5200" will return true. We are running an old version of PHP (4.3.6) but I haven't found any instance where this bug was encountered. If this error has already been corrected, if someone could let me know which version it was fixed, I'd appreciate it. Reproduce code: --------------- for($i = 4950; $i <= 5201; $i++){ $compareInt = "1D-$i"; if($compareInt == "1D-5155"){ echo "$compareInt == 1D-5155<BR>"; } else{ echo "$compareInt != 1D-5155<BR>"; } } Expected result: ---------------- I've generated a simple for loop that goes through all of the values in the range. One would expect that only one instance would be correct, namely the case where $compareInt is "1D-5155" Actual result: -------------- If you take a look at the code you will see the listing of which values are considered equal and which are not. For some reason all strings within the range of 4950 to 5201 are considered equal if they are compared against each other. All other strings outside of the range appear to be compared as expected.