tracker issue : CF-3316798

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

arrayDelete() returns false positives

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/AsDesigned

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 08/23/2012

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win All

Vote Count: 0

Problem Description:
I dunno whether arrayDelete() is supposed to be case-sensitive or not, but either way, it's got casing bugs

Steps to Reproduce:
<cfscript>
struct function getTestData(){
	var data = {};
	data.struct	= {one="tahi"};
	data.array	= ["rua", "toru"];
	data.simple	= "wha";
	
	data.test = [
		data.struct,
		data.array,
		data.simple
	];
	return data;
}

string function ok(array){
	return arrayLen(array) == 3 ? "DELETED" : "NOT DELETED";
}


data = getTestData();
arrayDelete(data.test, "WHA");
writeOutput("Delete simple value, different case: #ok(data.test)#<br />");


data = getTestData();
elementToFind = {one="TAHI"};
arrayDelete(data.test, elementToFind);
writeOutput("Delete equivalent struct with different-cased key: #ok(data.test)#<br />");



data = getTestData();
elementToFind = ["RUA", "TORU"];
arrayDelete(data.test, elementToFind);
writeOutput("Delete equivalent array with different case: #ok(data.test)#<br />");
</cfscript>

Actual Result:
Depending on the test, it's either not deleting mismatched-case elements, or deleting them.

Expected Result:
It should either be case-sensitive, or not case-sensitive.  Not a mix of the two.

Any Workarounds:
Doesn't matter: it should work properly.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3316798

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Bug verified. (Comment added from ex-user id:vnigam)
Comment by Adobe D.
18382 | December 17, 2013 01:50:13 AM GMT
Struct is a CaseInsensitiveMap. So the case of key/value does not matter here. But not possible to go recursively inside an array and do the caseInsensitive equality check.
Comment by Awdhesh K.
18383 | December 17, 2013 08:35:02 AM GMT