CF9 - cfinvoke seems to search scopes in different order
We came across this in a legacy app when it was moved to CF9 -- a cfinvoke that had always worked in previous versions seemed to stop working whereas invoking the same method using function notation returned the right results.
I've only tested the following on CF9 but it demonstrates the problem we had on CF9 which did not exist in previous versions.
This uses cfinvoke and function notation to call the same method and they return two different results -- cfinvoke returns an emptry struct, the function notation returns a correctly populated struct.
Application.cfm:
<cfapplication name="cf9test"
sessionmanagement="Yes"
setclientcookies="Yes"
sessiontimeout="#createTimeSpan(0,0,60,0)#"
applicationtimeout="#createTimeSpan(1,0,0,0)#">
test.cfc:
<cfcomponent output="true">
<cffunction name="func1" returntype="struct">
<cfargument name="stObject" required="no" default="#structNew()#">
<cfinvoke component="#this#"
method="func3"
returnVariable="stObject"><!--- Returns into Variables scope --->
<!--- Returns the empty struct in arguments.stObject --->
<cfreturn stObject/>
</cffunction>
<cffunction name="func2" returntype="struct">
<cfargument name="stObject" required="no" default="#structNew()#">
<cfscript>
stObject = func3(); // Returns into Arguments scope
</cfscript>
<cfreturn stObject/>
</cffunction>
<cffunction name="func3" returntype="struct">
<cfscript>
stTest = structnew();
stTest.foo = "blah";
stTest.blah = "bingo";
</cfscript>
<cfreturn stTest />
</cffunction>
</cfcomponent>
index.cfm:
<cfinvoke component="cf9test.test"
method="func1"
returnVariable="stObject">
Return from the cfinvoke:
<cfdump var="#stObject#">
<cfset structClear(stObject)>
<br />
<cfinvoke component="cf9test.test"
method="func2"
returnVariable="stObject">
Return from the function
<cfdump var="#stObject#">
