tracker issue : CF-4139644

select a category, or use search below
(searches all categories and all time range)
Title:

EQ parses string as numeric and results in true

| View in Tracker

Status/Resolution/Reason: To Fix//HaveNewInfo

Reporter/Name(from Bugbase): Toby Weston / Toby Weston (Toby Weston)

Created: 04/13/2016

Components: Language

Versions: 2016,11.0,10.0,2018

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Win All

Vote Count: 0

Problem Description:

When using EQ to compare strings that are numbers it assumes they are numeric and the same. It should be comparing them as a string.

<cfset a = "10">
<cfset b = "10.">
<cfoutput>#a EQ b#</cfoutput>

In CF 10 / 11 / 2016 the result of this is YES.

They are not the same, b has a . in the string.

Lucee correctly shows this as false

Steps to Reproduce:

Run the code above


Actual Result:

Returns true


Expected Result:

Should return false


Any Workarounds:

Compare correctly sees these as different strings

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4139644

External Customer Info:
External Company:  
External Customer Name: Toby Weston
External Customer Email:  
External Test Config: My Hardware and Environment details:



CF 11, Win 2012

Attachments:

Comments:

I notice you do document the fact that this happens, but surely it shouldnt?
Comment by External U.
3097 | April 13, 2016 07:34:43 AM GMT