Title:
Bug 76181:(Watson Migration Closure)Optional arguments still show up in the arguments scope, but as undefined values (they're null)
| View in TrackerStatus/Resolution/Reason: Closed/Won't Fix/LowImpact
Reporter/Name(from Bugbase): Elliott Sprehn / Elliott Sprehn (Elliott Sprehn)
Created: 03/25/2009
Components: Language
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Platforms All
Vote Count: 5
Problem:
Optional arguments still show up in the arguments scope, but as undefined values (they're null).
This is VERY confusing because structKeyList/Array() will return the key, and cfloop will loop over the key, but accessing it causes an error.
Lots and lots of code has workaround for this (like Transfer) that requires looping over the entire structure deleting the keys, even com.adobe.System has manipulateArguments() to work around this internally.
Method:
<!--- comp.cfc --->
<cfcomponent>
<cffunction name="foo" returnType="struct">
<cfargument name="arg1" required="true">
<cfargument name="arg2" required="false" default="arg2">
<cfargument name="arg3" required="false">
<cfargument name="arg4">
<cfreturn arguments>
</cffunction>
</cfcomponent>
<!--- bug76181.cfm --->
<cfset args = new comp().foo(10)>
<cfdump var="#args#">
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3038002
External Customer Info:
External Company:
External Customer Name: Elliott Sprehn
External Customer Email: 202D59C844579997992016B7
External Test Config: 03/25/2009
Attachments:
Comments: