tracker issue : CF-3750734

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

list iteration & member functions all need to expect both a "delimiters" and a "includeEmptyValues" argument.

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

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

Created: 04/27/2014

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: PublicBeta /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 0

Listed in the version 11.0.03.292480 Issues Fixed doc
SSIA, but details: http://cfmlblog.adamcameron.me/2014/04/bugs-in-iterator-functions-in-both.html

Summary:

list = ",2,,4,,,7,,,,";
lengthNoEmpties = listLen(list);
lengthWithEmpties = listLen(list,",",true);

writeDump([list,lengthNoEmpties,lengthWithEmpties]);

writeOutput("<br>listFilter() with empties: ");
filtered = listFilter(list, function(v){
    if (isNumeric(v)){
        return v mod 2; // ie: odd numbers
    }
    return true;
}, ",", true);
writeDump([filtered]);

And results (Railo first):

Array
1	
string	,2,,4,,,7,,,,
2	
number	3
3	
number	11

listFilter() with empties:
Array
1	
string	,,,,7,,,,

So Railo gets it dead right.

ColdFusion:

The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
Parameter validation error for the LISTFILTER function.
The function accepts 2 to 3 parameters.

That's not right. The list iteration functions need to - across the board - also expect both a "delimiters" and a "includeEmptyValues" argument.

-- 
Adam

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

Watson Bug ID:	3750734

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

Attachments:

Comments:

The fix will be made available in the upcoming update.
Comment by S P.
12493 | September 01, 2014 10:40:41 PM GMT
This isn't fixed in CF11 Update 3 (as of build 11,0,03,291742). The code in the example returns 7 (instead of ,,,,7,,,,). Example: writeOutput(listFilter("1,,2,,3", function(){return true;}, ",", true));//returns 1,2,3 (bad - should return 1,,2,,3) writeOutput(listFilter("1,,2,,3", function(){return true;}, ",", false));//returns 1,2,3 (good) Thanks!, -Aaron
Comment by External U.
12494 | November 06, 2014 09:03:34 PM GMT
Verified this is fixed in CF11 Update 3 (11,0,03,292245(PreRelease)). writeOutput(listFilter("1,,2,,3", function(){return true;}, ",", true));//returns 1,,2,,3 Thanks!, -Aaron
Comment by External U.
12495 | November 20, 2014 10:54:06 PM GMT