Re: Overriding ColdFusion's ArgumentCollection
- December 3, 2008 10:40 AM
- ColdFusion
- Comments (1)
Ben Nadel found an interesting problem with ArgumentCollection, and I've done some additional tests that I find interesting. I was able to achieve the value fluctuation that Ben saw with only a single method based override on ColdFusion 8.0.1:
<!--- Trimmed down version of Ben's test function --->
<cffunction name="OutputArguments" output="true">
<!--- Output arguments. --->
<cfdump var="#ARGUMENTS#" label="From OutputArguments()"/>
</cffunction>
<!--- Define the argument collection. --->
<cfset objArgs = {
Naomi = "Sweet",
Kit = "Tough",
Christina = "Cocky"
} />
<!---
Invoke the test method using both the argument
collection and an overriding value.
--->
<cfset OutputArguments(
ArgumentCollection = objArgs,
Naomi = "Wicked hot"
) />
Multiple refreshes saw the Naomi listed as "Sweet" more often then not. Ben had stated in his post that he saw fluctuations in value when using only a single CFINVOKE, but stable results with the method version. I'm sing the opposite; values seem constant when using CFINVOKE.
<!--- Trimmed down version of Ben's test function --->
<cffunction name="OutputArguments" output="true">
<!--- Output arguments. --->
<cfdump var="#ARGUMENTS#" label="From OutputArguments()"/>
</cffunction>
<!--- Define the argument collection. --->
<cfset objArgs = {
Naomi = "Sweet",
Kit = "Tough",
Christina = "Cocky"
} />
<!---
Invoke the test method using both the argument
collection and an overriding value.
--->
<cfinvoke
method="OutputArguments"
argumentcollection="#objArgs#">
<!--- Override argument. --->
<cfinvokeargument name="Naomi" value="Very Cute" />
</cfinvoke>
Added examples on my site:
Comments