将列表传递给需要数字参数的函数时出错 - 在 CF9 中有效但在 CF11 中无效

Error when passing a list to a function expecting a numeric argument-worked in CF9 but not in CF11

无论出于何种原因(正确或错误),我们都有一个函数声明:

<cffunction name="findaccount" access="public" returntype="struct">
    <cfargument name="roles" type="numeric" required="true" default="1">
    ...
</cffunction>

然后函数被

调用
<cfinvoke method="findaccount" returnvariable="stAccountDetails">
    <cfinvokeargument name="roles" value="1,2">
</cfinvoke>

不管将列表传递给需要数字的函数的初衷如何,这段代码在 CF9 中已经运行了很长时间。最近我们决定升级到 CF11,代码抛出以下异常:

Detail: If the component name is specified as a type of this argument, it is possible that either a definition file for the component cannot be found or is not accessible. 
Message: The ROLES argument passed to the findaccount function is not of type numeric. 

搜索的时候发现了类似的问题here。我的问题是:考虑到有很多这样的调用,是否对我的案例进行类型检查(如 Adam Cameron 所建议的那样)是最好的解决方法?

不行,不要按我说的去做

如果你按照 the link to the bug 我提出的(在我的回答中提到),Adobe 的某人澄清了发生了什么。它也会影响其他情况和您的情况:

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.