tracker issue : CF-4204024

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

sameFormFieldsAsArray setting not always respected

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Mark B. / ()

Created: 02/14/2019

Components: Application Framework, ApplicationCFC

Versions: 2016,11.0,2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 311402 / latest build

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Linux

Vote Count: 0

Problem Description:
When dumping the form scope inside Application.cfc, either outside any functions, or even in a function such as onRequestStart, the scope contains data as if sameFormFieldsAsArray were set to true. The default (according to the documentation) is that its set to false which I do see happening if I'm not using an Application.cfc or if I dump the form scope further down the line inside a controller of an MVC application using either Fusebox or FW/1.

This is especially troublesome for Fusebox applications as the attributes scope is generated in the Application component where the setting does not seem to be respected.

Steps to Reproduce:
Use the two files from the following Gist:

Check one or both of the checkboxes and select one or both of the multi-select options and submit the form.

Actual Result:
Despite having set the sameFormFieldsAsArray setting to "false", when dumping immediately after, the form scope contains the "checkbox" and "multiSelectField" values as arrays. The form scope dumps this way if dumped outside any functions in Application.cfc as well as inside a function such as onRequestStart. The example is greatly simplified but is also present in more complex applications with fully-featured application CFCs.

Expected Result:
In the dump after submitting the form, the "checkbox" and "multiSelectField" values should be comma-separated strings.

Any Workarounds:
I can flatten the arrays manually in onRequestStart to preserve backwards compatibility with previous versions of ColdFusion.