Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce
Reporter/Name(from Bugbase): William D. / ()
Created: 01/22/2019
Components: Language, Script CFC
Versions: 2016
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2016,0,03,300466 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Windows 10 64 bit
Vote Count: 0
Problem Description:
In recursive functions, Coldfusion seems to default to the outer-most scope in some conditions resulting in infinite recursion. Additionally, specifically using the "arguments" scope for the structToFlatten seemed to make no difference.
Steps to Reproduce:
Code example: (Code simplified for sake of demonstration)
public string function doThing(required struct thing) {
var thingString = "";
var keyArray = arrayNew(1);
// thing correct here
for (key in thing) {
// structToFlatten correct here
}
var keyList = listSort(arrayToList(keyArray),"text");
for (i = 1; i lte listLen(keyList); i++) {
var key = listgetat(keyList, i);
var obj = thing[key];
// thing, key, obj is from outermost scope here
if(isStruct(obj)) {
// thing, key, obj is from outermost scope here
thingString = doThing(obj);
}
}
return thingString;
}
Actual Result:
Recurses infinitely as it is continuously working on the same object which consistently meets the requirements to recurse.
Expected Result:
Uses the variable passed to it in the arguments
Any Workarounds:
No
Attachments:
Comments: