Re: Overriding ColdFusion's ArgumentCollection

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

Ben Nadel's Gravatar Uh oh :) That's not good. Not only do we have some sort of bug - it's a bug that's not even consistently inconsistent :)
Comments are not allowed for this entry.
Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me on LinkedIn.