Title:
Equality (eq) result is incorrect for some strings with numbers and commas or hyphens
| View in TrackerStatus/Resolution/Reason: To Track//NeedMoreInfo
Reporter/Name(from Bugbase): Dave Merrill / Dave Merrill (Dave Merrill)
Created: 09/25/2014
Components: Language
Versions: 9.0.1
Failure Type:
Found In Build/Fixed In Build: 9.0.1 /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 7
Vote Count: 1
Problem Description: Asking whether two strings are equal with the eq operator gives incorrect results in some cases, specifically some strings containing only numbers and commas or hyphens. Behavior of any given pair of strings is 100% consistent, but I don't see any logic to which ones give correct results and which ones don't.
Steps to Reproduce: Put the following code in a cfm file and run it:
<cfoutput><pre>
#"1821,9" eq "9,1821"#
#"12,91" eq "91,12"#+
#"1821,91" eq "91,1821"#
#"1821-9" eq "9-1821"#
#"12-91" eq "91-12"#
#"1821-91" eq "91-1821"#
<pre></cfoutput>
Actual Result:
YES
YES
NO
YES
YES
NO
Expected Result: None of those strings are actually the same, all tests should return NO.
NO
NO
NO
NO
NO
NO
Any Workarounds:
Use compare() instead of eq, or add a letter at the start or end of both values. But the bottom line is that this is very very wrong, and shouldn't have to be coded around.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3831792
Reason: BugVerified
External Customer Info:
External Company:
External Customer Name: dmerrill
External Customer Email:
External Test Config: My Hardware and Environment details: Tested CF 9 and 11, behavior is the same, didn't test other versions. I'm on Windows 7 Pro SP1, behavior was also seen with CF 11 on Windows Server 2008 R2.
Attachments:
Comments: