tracker issue : CF-4202903

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

[ANeff] Bug for: FindAll must simply be the "find all" variant

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 06/18/2018

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.0.310409 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Platforms All

Vote Count: 0

Issue: FindAll must simply be the "find all" variant

Notes (for language consistency/predictability):
1) ArrayFindAll() must simply be the "find all" variant of ArrayFind()
2) ArrayFindAllNoCase() must simply be the "find all" variant of ArrayFindNoCase()

Thus, if:
- ArrayFind() searches a haystack for the 1st matching needle
and
- ArrayFindNoCase() *only* string-searches a haystack for the 1st matching case-insensitive string

Then:
- ArrayFindAll() must search a haystack for all matching needles
and
- ArrayFindAllNoCase() must *only* string-search a haystack for all matching case-insensitive strings

Important: The word "All" doesn't mean it searches for more -types-. It means that it searches for more _positions_.

Repro:
{code:java}
<cfscript>
  haystack = [{foo="Bar"},function(){return true}]
  
  arrayFind(haystack, {foo="Bar"})//no error
  arrayFind(haystack, function(){return true})//no error
  arrayFindNoCase(haystack, {foo="Bar"})//exception
  arrayFindNoCase(haystack, function(){return true})//exception
  
  arrayFindAll(haystack, {foo="Bar"})//no error
  arrayFindAll(haystack, function(){return true})//no error
  arrayFindAllNoCase(haystack, {foo="Bar"})//no error
  arrayFindAllNoCase(haystack, function(){return true})//no error
</cfscript>
{code}


Actual Result: arrayFindAll() is simply the "find all" variant of arrayFind() (good), but arrayFindAllNoCase() is not simply the "find all" variant of arrayFindNoCase().

Expected Result: "FindAll" is simply the "find all" variant.

See? arrayFind() only does a string-search. But, arrayFindAllNoCase() searches for _more types_ (i.e. it doesn't *only* do a string search, and therefore is _not_ the "find all" variant of arrayFindNoCase()).

Thus, in the above repro, either A) arrayFindNoCase() must not throw an exception or B) arrayFindAllNoCase() must throw an exception.

Attachments:

Comments:

ArrayFindNocase would only search for strings,number and boolean. This was changed as part of bug :  [https://tracker.adobe.com/#/view/CF-3316776] We will fix ArrayFindAllNoCase to only search for strings,number and boolean. This will maintain consistency.   This is duplicate of [https://tracker.adobe.com/#/view/CF|https://tracker.adobe.com/#/view/CF-3316776]-4202901. Hence , closing this. 
Comment by Suchika S.
29140 | June 28, 2018 12:41:00 PM GMT