tracker issue : CF-3134331

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

CF too liberal in what it will cast to a date

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 03/09/2012

Components: Language

Versions: 2016,11.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: 9.0 / 2018.0.0.309259

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Win XP All

Vote Count: 9

See this thread on the Adobe forums:
http://forums.adobe.com/message/4219877#4219877

Summary:
All of this can be somewhat simplified to this:
  
<cfif "0,6" eq "6,0">
          EQUALS
<cfelse>
          NOT EQUALS
</cfif>
And the answer is - according to CF - "EQUALS".
 
My reaction to that is:
 
WTF?
 
[...]

Someone from Adobe has explained this to me.  Believe it or not, both "0,5" and "5,0" - to CF - mean 0th May 2012... which equates to 30 April 2012 ("of course" we all cry, whilst slapping our foreheads ;-).
 
Example:
<cfset d1 = "0,5">
<cfset d2 = "5,0">
 
<cfoutput>
          #dateFormat(d1)#<br />
          #dateFormat(d2)#<br />
</cfoutput>
 

Bottom line: strings of format "n,m" where n and m are numeric and fall within the range of month numbers or date-of-month numbers (including 0 in this case) are cast to dates, which is inappropriate.  In no situation is "d,m" or "m,d" considered a date, and CF should not treat it as such.

-- 
Adam

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

Watson Bug ID:	3134331

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Too risky to change anything related to this at this stage. It also has backward compatibility issue and it needs to be thought out and planned well before implementing. Deferring
Comment by Rupesh K.
20157 | March 12, 2012 08:08:59 AM GMT
I don't want to live in a world where the string '0,6' is equal to '6,0'.
Vote by External U.
20161 | July 18, 2012 06:44:50 PM GMT
Seriously Adobe needs to STOP using this backwards compatibility issue to not fix bugs which can cause REAL ISSUES for developers in their applications.
Vote by External U.
20162 | February 21, 2014 05:17:00 PM GMT
Agree with Mary Jo and Mike
Vote by External U.
20163 | February 24, 2014 12:56:56 PM GMT
I believe that a language ought do what it says it does, and have a certain amount of grounding in reality. That is, if I say I am testing for an integer, I ought expect that an integer will pass, and a non-integer fail.
Vote by External U.
20164 | October 09, 2014 04:47:54 PM GMT
Ugh. Please stop trying to out think us poor developers.
Vote by External U.
20165 | October 24, 2014 06:05:23 PM GMT
+1 - I have no use for treating 0,6 (example) as a date
Vote by External U.
20166 | November 24, 2014 06:04:40 AM GMT
+1 ...........................................................
Vote by External U.
20167 | June 30, 2015 04:25:35 AM GMT
See also : (1,875 lt 80) == true http://trycf.com/scratch-pad/gist/548c4ee5d2a617e4e88e Instead it should throw an error, or treat the left hand side as 1875 (the number) in the sort of comparison.
Vote by External U.
20168 | June 30, 2015 04:27:27 AM GMT
We can evaluate this for the next release
Comment by Vamseekrishna N.
20158 | October 03, 2016 12:45:57 AM GMT
I really hope you are referring to the release currently in development to follow CF 2016.
Comment by External U.
20159 | October 03, 2016 09:41:41 AM GMT
+1 Found same issue CF 11 update 10 Please fix. <cfif "0001" EQ "000001"> This is not equal </cfif>
Comment by External U.
20160 | October 13, 2016 09:42:45 AM GMT
+1
Vote by External U.
20169 | October 13, 2016 09:42:58 AM GMT