tracker issue : CF-4204688

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

araryEach() stopped passing array reference to UDF in 2018

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Bradley W. / ()

Created: 06/28/2019

Components: Language

Versions: 2018

Failure Type: Data Loss

Found In Build/Fixed In Build: 2018 / CF2018U5

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Platforms All

Vote Count: 1

Problem Description:

The following code dumps out 3 parameters in the arguments for Railo, Lucee, and Adobe 11, and 2016 scope (value, index, and original array)

arrayeach( ['a'], function() {
    writeDump( arguments );
} );

But it only dumps two items in ACF 2018.  (the original array is missing)

Steps to Reproduce:

arrayeach( ['a'], function() {
    writeDump( arguments );
} );

Actual Result:

Array reference is not passed to UDF.

Expected Result:

Array reference should be passed to UDF.

Any Workarounds:

No.

Attachments:

Comments:

If you specify the argument names, then the original array is accessible inside the callback function. Example: {code} data = ['a']; arrayeach(data, function(element, index, original) { writeDump( arguments ); } ); {code} That gives you: {code} ELEMENT: a INDEX: 1 ORIGINAL: [a] {code} Runable version: https://cffiddle.org/app/file?filepath=cbe33e8c-5d99-48f0-9b0d-e5bbc2835f9c/644ba667-d7a7-4e06-81c9-a2a93332c1b1/7eb15ed3-e2ed-416c-a1f7-fd65a3dd080b.cfm
Comment by John W.
30966 | June 28, 2019 08:17:55 AM GMT
Very interesting-- I wonder how that is even possible. You wouldn't be able to do that with a standard UDF call as all positional parameters would present themselves in the arguments scope. I wonder if they are changing the call based on the declaration of the UDF?
Comment by Bradley W.
30969 | June 28, 2019 04:56:26 PM GMT