tracker issue : CF-3877068

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

Type coercion failure when passing boolean to a numeric arg

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

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

Created: 12/12/2014

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 4

Repro:
<cfscript>
function f(numeric x){}
f(false);
</cfscript>

On ColdFusion 11, we get this:

The X argument passed to the f function is not of type numeric.

On earlier versions of ColdFusion and Railo, it works fine (as it should).

false should be cast to a numeric (0) here.

This is non-theoretical, as it's impacting your client's code: http://stackoverflow.com/q/27447751/894061

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

Watson Bug ID:	3877068

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

Attachments:

Comments:

+1 ......................
Vote by External U.
9427 | December 12, 2014 06:26:36 PM GMT
+1........................
Vote by External U.
9428 | December 12, 2014 10:38:13 PM GMT
+1 ////////////////////////////////
Vote by External U.
9429 | December 13, 2014 07:30:25 AM GMT
+1 ///////////////////////
Vote by External U.
9430 | December 13, 2014 10:29:16 AM GMT
In CF 11 a new application setting was introduced: strictnumbervalidation = "true|false" By default the value of this setting is "true", which introduces strict number validation. Setting this value to "false" explicitly , will make the validation behave in old way.
Comment by Mayur J.
9425 | January 27, 2015 03:50:48 AM GMT
I think this needs reopening or retasking to get something written in some release notes about this. You can't make changes like this and then not tell people: it breaks their code. I've had to deal with two of your clients who had their sites break because of this. I can't find anywhere you actually TELL people about this change (except for here, and the docs for application settings (https://wikidocs.adobe.com/wiki/display/coldfusionen/Application+variables)) You also need to (NEED TO) list this in release notes or a change log or something.
Comment by External U.
9426 | February 24, 2015 12:45:11 PM GMT