Status/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): Bob Silverberg / Bob Silverberg (Bob Silverberg)
Created: 04/22/2009
Components: Language, CF Component
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Major / Unknown
Locale/System: English / Win All
Vote Count: 0
Problem:
Problem with cfinvoke combined with onMissingMethod. The arguments received by onMissingMethod are stored as a struct with numeric keys, and when that struct is passed into <cfinvoke> using argumentcollection those keys are not being matched up with the expected arguments of the called function. This throws an error in CF9, but it works in CF8, breaking backwards compatibility.
If this seems unclear, take a look at the sample code and you'll see the problem. Please note that this does seem like expected behaviour, except that it currently works in CF8.
Note that there is a workaround, but it is pretty ugly.
Method:
1. Create two files:
TestCFM.cfm, which contains:
<cftry>
<cfset createObject("component","TestCFC").unknownMethod(a:1,b:2)>
<cfcatch type="any">
<cfdump var="#cfcatch#" >
</cfcatch>
</cftry>
<cftry>
<cfset createObject("component","TestCFC").unknownMethod(1,2)>
<cfcatch type="any">
<cfdump var="#cfcatch#" >
</cfcatch>
</cftry>
and TestCFC.cfc, which contains:
<cfcomponent>
<cffunction name="onMissingMethod" hint="method to handle missing methods" access="public" returntype="Any" output="true">
<cfargument name="missingMethodName" type="string" required="true">
<cfargument name="missingMethodArguments" type="struct" required="false" default="#StructNew()#">
<cfdump var="#arguments#">
<cfinvoke method="test" argumentcollection="#arguments.missingMethodArguments#" />
</cffunction>
<cffunction name="test" hint="method to handle missing methods" access="public" returntype="Any" output="true">
<cfargument name="a" type="Any" required="true" />
<cfargument name="b" type="Any" required="true" />
<cfdump var="#arguments#">
</cffunction>
</cfcomponent>
2. Run TestCFM.cfm
3. In CF8 it will work with no errors, whereas in CF9 the second method call will cause an error.
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3038292
External Customer Info:
External Company:
External Customer Name: Bob Silverberg
External Customer Email: 5AD606C248A4C7F0992015A9
External Test Config: 04/22/2009
Attachments:
Comments: