tracker issue : CF-4202905

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

[ANeff] Bug for: ArrayFindNoCase denies some strings

| View in Tracker

Status/Resolution/Reason: To Test//HaveNewInfo

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

Note: In ColdFusion, all simple values can be treated/validated as a string. A UDF string argument accepts a date. IsValid("string", now()) returns true. Etc, etc.

Issue: ArrayFindNoCase denies some strings

Repro 1:

ArrayFindAllNoCase/ArrayContainsNoCase/ArrayDelete accept any string, including date (good)
{code:java}
<cfscript>
  myArray=[]
  writeOutput(arrayFind(myArray, now()))//0
  writeOutput(arrayLen(arrayFindAll(myArray, now())))//0
  writeOutput(arrayContains(myArray, now()))//NO
  writeOutput(arrayDelete(myArray, now()))//NO
  writeOutput(arrayLen(arrayFindAllNoCase(myArray, now())))//0
  writeOutput(arrayContainsNoCase(myArray, now()))//NO
  writeOutput(arrayDeleteNoCase(myArray, now()))//NO
</cfscript>
{code}

Actual and Expected Result: 00NONO0NONO

Repro 2:
ArrayFindNoCase denies dates (bad)
{code:java}
<cfscript>
  myArray=[]
  writeOutput(arrayFindNoCase(myArray, now()))//exception
</cfscript>
{code}

Actual Result: exception "Valid datatype for element to search is String."

Expected Result: 0

Basically, in the following, arrayFindNoCase() must never throw an exception when a date is passed to the myString argument and thru isValid("string", ..):
{code:java}
<cfscript>
  function f(required array myArray=[], required string myString) {
    if(isValid("string", myString)) {
      writeOutput(arrayFindNoCase(myArray, myString))
    }
  }
</cfscript>
{code}

Attachments:

Comments:

Hi Adobe, This issue is not limited to ArrayFindNoCase. Could you please update this to cover ArrayFindNoCase/ArrayFindAllNoCase/ArrayContainsNoCase/ArrayDeleteNoCase (both the BIF and member function for each)? They all should treat a date search the same. Thanks!, -Aaron
Comment by Aaron N.
31237 | August 28, 2019 07:15:06 AM GMT
Note: Implementing CF-4205066 would make this ticket irrelevant. Thanks!, -Aaron
Comment by Aaron N.
31238 | August 28, 2019 07:16:22 AM GMT