I am migrating an application from ColdFusion 9 to ColdFusion 11.
The existing code has a false variable assignment:
<cfset VARIABLES.roleTypeId = false >
And then, further, a function that expects this variable to be numeric:
<cffunction name="rolesForStudy" > <cfargument name="id" hint="Study Id"> <cfargument name="roleTypeId" default="#VARIABLES.roleTypeId#" type="numeric"/> </cffunction>
I inherited the code, and I can’t protect the original programmer’s solution to configure it this way, but, in short, it worked in ColdFusion 9 and it does not work in ColdFusion 11 (returning a data type error). I assume ColdFusion 9 automatically converted false to 0 .
My question is: is there a configuration parameter that I can change in ColdFusion 11 to do this conversion, like ColdFusion 9? Or will I have to fix this code, as well as probably many other similar examples throughout the application? Neither I nor our ColdFusion administrator could find any information about this in the ColdFusion admin interface, the ColdFusion documentation, or the web.
Edit in response to Adam Cameron in the comments.
I created a file that consists of the following 10 lines (and nothing more):
<cfset VARIABLES.roleTypeId = false > <cfoutput> <p>#rolesForStudy( 1, VARIABLES.roleTypeId )#</p> </cfoutput> <cffunction name="rolesForStudy" > <cfargument name="id" hint="Study Id"> <cfargument name="roleTypeId" default="#VARIABLES.roleTypeId#" type="numeric"/> <cfreturn "It worked" > </cffunction>
When I run it in ColdFusion 9, it displays the words "It worked."
when I run it in ColdFusion 11, it returns the following error message:
If the component name is specified as the type of this argument, it is possible that the definition file for the component cannot be found or is not available.