1

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

<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. 

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

4

1 回答 1

4

不,不要照我说的做。

如果您按照我提出的错误的链接(在我的回答中提到),Adobe 的某人澄清了发生了什么。它会影响其他情况以及您的情况:

在 CF 11 中引入了一个新的应用程序设置:strictnumbervalidation = "true|false" 默认情况下,此设置的值为 "true",它引入了严格的数字验证。将此值显式设置为“false”,将使验证以旧方式运行。

于 2015-02-24T18:11:24.897 回答