Title:
[ANeff] Bug for: Pre-CF2018 vs CF2018 w.r.t. Array Case/NoCase searching of simple values
| View in TrackerStatus/Resolution/Reason: To Fix//Investigate
Reporter/Name(from Bugbase): Aaron N. / ()
Created: 08/28/2019
Components: Language, Functions
Versions: 2018
Failure Type: Data Corruption
Found In Build/Fixed In Build: 2018.0.04.314546 /
Priority/Frequency: Normal / Some users will encounter
Locale/System: / Windows 10 64 bit
Vote Count: 0
Issue: Pre-CF2018 (CF10/CF11/CF2016) vs CF2018 w.r.t. Array Case/NoCase searching of simple values
CF2018 breaks backward-compat w.r.t. searching some simple values in arrays.
Note: Please ignore if this is a duplicate. I reported this during public beta but I can't seem to find a ticket about it.
Repro:
Comment out each 'haystack' variable, then compare result on CF2016 and CF2018.
<cfscript>
columnList = "acfBuild,acfFunction,stringTrue,booleanTrue,numberOne,stringFalse,booleanFalse,numberZero";
result = queryNew(columnList);
acfBuild = SERVER.ColdFusion.productVersion;
haystack = [1,"true",true,0,"false",false];//try this
//haystack = [true,false];//then try this
needles = [{type="stringTrue", value="true"}, {type="booleanTrue", value=true}, {type="numberOne", value=1}, {type="stringFalse", value="false"}, {type="booleanFalse", value=false}, {type="numberZero", value=0}];
functionNames = ["arrayFind","arrayFindNoCase","arrayFindAll","arrayFindAllNoCase","arrayContains","arrayContainsNoCase","arrayDelete","arrayDeleteNoCase"];
for(functionName in functionNames) {
rowToAdd = {acfBuild=acfBuild, acfFunction='#functionName#()'};
for(needle in needles) {
try {rowToAdd[needle.type] = evaluate("#functionName#(duplicate(haystack), needle.value)");}
catch(any e) {rowToAdd[needle.type] = e.message;}
if(isArray(rowToAdd[needle.type])) {
rowToAdd[needle.type] = arrayToList(rowToAdd[needle.type]);
}
}
result.addRow(rowToAdd);
}
writeDump(result);
</cfscript>
Actual and Expected Result on CF2016:
With 1st haystack enabled:
query
acfBuild acfFunction booleanFalse booleanTrue numberOne numberZero stringFalse stringTrue
1 2016,0,01,298513 arrayFind() 4 1 1 4 4 1
2 2016,0,01,298513 arrayFindNoCase() 4 1 1 4 4 1
3 2016,0,01,298513 arrayFindAll() 4,5,6 1,2,3 1,2,3 4,5,6 4,5,6 1,2,3
4 2016,0,01,298513 arrayFindAllNoCase() 4,5,6 1,2,3 1,2,3 4,5,6 4,5,6 1,2,3
5 2016,0,01,298513 arrayContains() YES YES YES YES YES YES
6 2016,0,01,298513 arrayContainsNoCase() YES YES YES YES YES YES
7 2016,0,01,298513 arrayDelete() YES YES YES YES YES YES
8 2016,0,01,298513 arrayDeleteNoCase() YES YES YES YES YES YES
With 2nd haystack enabled:
query
acfBuild acfFunction booleanFalse booleanTrue numberOne numberZero stringFalse stringTrue
1 2016,0,01,298513 arrayFind() 2 1 1 2 2 1
2 2016,0,01,298513 arrayFindNoCase() 2 1 1 2 2 1
3 2016,0,01,298513 arrayFindAll() 2 1 1 2 2 1
4 2016,0,01,298513 arrayFindAllNoCase() 2 1 1 2 2 1
5 2016,0,01,298513 arrayContains() YES YES YES YES YES YES
6 2016,0,01,298513 arrayContainsNoCase() YES YES YES YES YES YES
7 2016,0,01,298513 arrayDelete() YES YES YES YES YES YES
8 2016,0,01,298513 arrayDeleteNoCase() YES YES YES YES YES YES
Actual and Unexpected Result on CF2018:
With 1st haystack enabled:
query
acfBuild acfFunction booleanFalse booleanTrue numberOne numberZero stringFalse stringTrue
1 2018,0,04,314546 arrayFind() 5 2 1 4 4 1
2 2018,0,04,314546 arrayFindNoCase() 5 2 1 4 4 1
3 2018,0,04,314546 arrayFindAll() 5,6 2,3 1,2 4,5 4,5,6 1,2,3
4 2018,0,04,314546 arrayFindAllNoCase() 5,6 2,3 1,2 4,5 4,5,6 1,2,3
5 2018,0,04,314546 arrayContains() YES YES YES YES YES YES
6 2018,0,04,314546 arrayContainsNoCase() YES YES YES YES YES YES
7 2018,0,04,314546 arrayDelete() YES YES YES YES YES YES
8 2018,0,04,314546 arrayDeleteNoCase() YES YES YES YES YES YES
With 2nd haystack enabled:
query
acfBuild acfFunction booleanFalse booleanTrue numberOne numberZero stringFalse stringTrue
1 2018,0,04,314546 arrayFind() 2 1 0 0 2 1
2 2018,0,04,314546 arrayFindNoCase() 2 1 0 0 2 1
3 2018,0,04,314546 arrayFindAll() 2 1 [empty string] [empty string] 2 1
4 2018,0,04,314546 arrayFindAllNoCase() 2 1 [empty string] [empty string] 2 1
5 2018,0,04,314546 arrayContains() YES YES NO NO YES YES
6 2018,0,04,314546 arrayContainsNoCase() YES YES NO NO YES YES
7 2018,0,04,314546 arrayDelete() YES YES NO NO YES YES
8 2018,0,04,314546 arrayDeleteNoCase() YES YES NO NO YES YES
This reveals that all these functions are searching some of the values incorrectly.
Please ensure the fix applies to all these functions.
CF's auto-casting ensures the silent 'data corruption' aspect of this issue.
Attachments:
Comments: