tracker issue : CF-3750733

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

listFilter() doesn't correctly handle multi-char delimiters

| 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 / CF11 Update5

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 0

Listed in the version 11.0.05.293506 Issues Fixed doc
See:
http://cfmlblog.adamcameron.me/2014/04/bugs-in-iterator-functions-in-both.html

Repro:
original = "11,23;31:43^53-61";
delims = ",;:^-";

filtered = listFilter(original,function(v){
     return reFind("3$", v);
},delims);

writeDump([original,filtered]);

On both Railo (4.2.0.007) and ColdFusion (11 beta) we get this:

Array
1	
string	11,23;31:43^53-61
2	
string	23,;:^-43,;:^-53

-- 
Adam

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

Watson Bug ID:	3750733

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

Attachments:

Comments:

The current behavior is indeed undesirable but the proposed behavior is also not correct, IMO. We should do what we we do in ListSort - if it is multi-character delimiter, use the first character as the demiliter in the resulting list.
Comment by Rupesh K.
12497 | November 21, 2014 12:17:52 AM GMT
To keep the behaviour of ColdFusion coherent (matching with the behaviour of ListSort), now the tokens in the result of ListFilter are separated by the first character of the delimiter string.
Comment by Nikhil S.
12498 | November 24, 2014 05:21:37 AM GMT
Fair enough. Cheers Nikhil & Rupesh.
Comment by External U.
12499 | December 17, 2014 03:21:03 AM GMT
The fix for this bug is available in the pre-release build of ColdFusion 11 Update 5
Comment by CFwatson U.
12500 | February 20, 2015 09:26:11 AM GMT
Confirmed fixed, cheers.
Comment by External U.
12501 | February 21, 2015 08:03:01 PM GMT