Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Bob G. / ()
Created: 05/28/2019
Components: Language, Application Framework, PerAppSettings
Versions: 2018
Failure Type: Non Functioning
Found In Build/Fixed In Build: 2018.0.03.314033 / CF2018U5
Priority/Frequency: Critical / Some users will encounter
Locale/System: English / Other
Vote Count: 0
sameFormFieldsAsArray results in array like object not real array
Problem Description:
When settting sameFormFieldsAsArray to true in the Application.cfc the value in the form scope cause an error when used with array member functions and when passed in to some array functions.
Steps to Reproduce:
Application.cfc
--------------------
<cfcomponent>
<cfset this.name = "fields-as-fake-array-" & hash(getCurrentTemplatePath()) />
<cfset this.sameFormFieldsAsArray = true />
</cfcomponent>
index.cfm
-------------
<cfif form.keyExists("items") && isArray(form.items)>
<cfset form.items.append(4) />
<cfset arrayAppend(form.items, 4) />
</cfif>
<form method="POST">
<input name="items" value="1">
<input name="items" value="2">
<input name="items" value="3">
<button type="submit">Submit</button>
</form>
Actual Result:
Calling append on the array field throws an exception.
Expected Result:
Arrays resulting from sameFormFieldsAsArray should be real arrays and not array like objects. All methods and array functions should work without exceptions.
Any Workarounds:
<cfset form.items = arraySlice(form.items) />
Attachments:
Comments: