tracker issue : CF-4205212

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: ArgumentCollection accepts array in invoke()/cfinvoke but not direct method calls

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): Aaron N. / ()

Created: 09/15/2019

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.04.314546 /

Priority/Frequency: Normal / Very few users will encounter

Locale/System: / Platforms All

Vote Count: 0

Issue: CF10 enhanced ArgumentCollection by allowing it to accept an array, however this doesn't work in direct method calls.

Repro:

{code:java}
<cfscript>
 function f(required string a1, required string a2)

{return ARGUMENTS.a1 & ARGUMENTS.a2}

myArgumentArray = ["Cold","Fusion"];
 writeOutput(invoke("", "f", myArgumentArray) & '<br>');//ColdFusion (good)
 cfinvoke(method="f", returnvariable="r", argumentcollection=myArgumentArray)
 writeOutput(r & '<br>');//ColdFusion (good)
 </cfscript>
{code}

 
{code:java}
<cfinvoke method="f" returnvariable="r" argumentcollection="#myArgumentArray#">
 <cfoutput>#r#<br></cfoutput><!--- ColdFusion (good) --->
<cfoutput>#f(argumentCollection=myArgumentArray)#</cfoutput><!--- coldfusion.runtime.MissingArgumentException (bad) --->
{code}

Expected Result:

ColdFusion
 ColdFusion
 ColdFusion
 ColdFusion

Expected Result:

ColdFusion
 ColdFusion
 ColdFusion
 coldfusion.runtime.MissingArgumentException

History: CF8.0.1 allowed a numerically-keyed argumentCollection to be treated as ordered arguments, so that frameworks could use argumentCollection without needing to know the argument names. However, during CF10 PR, it was noted that the preferred solution would be for argumentCollection to accept an array. CF10 added support for the same, but, as shown above, the support is incomplete.

Attachments:

Comments: