tracker issue : CF-4205068

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

[ANeff] Bug for: Array Case functions cannot find XML

| View in Tracker

Status/Resolution/Reason: To Fix//Investigate

Reporter/Name(from Bugbase): Aaron N. / ()

Created: 08/28/2019

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.04.314546 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Platforms All

Vote Count: 0

Issue: Array Case functions cannot find XML

The ArrayFind/ArrayFindAll/ArrayContains/ArrayDelete docs say these functions search for complex objects excluding COM/CORBA. However, this isn't currently true for XML.

Repro:

MyCFC.cfc
-----------
component {function myFunction(){}}
-----------

index.cfm
-----------
<cfscript>
  o1 = new MyCFC();
  o2 = new MyCFC();
  q1 = queryNew("myColumn", "varchar", [["asdf"]]);
  q2 = queryNew("myColumn", "varchar", [["asdf"]]);
  cfxml(variable="xml1") {writeOutput("<myXML></myXML>");};
  cfxml(variable="xml2") {writeOutput("<myXML></myXML>");};
  haystacksAndNeedles = [
      {haystack=[["foo"]], needle=["foo"]},
      {haystack=[{foo="bar"}], needle={foo="bar"}},
      {haystack=[[foo="bar"]], needle=[foo="bar"]},
      {haystack=[o1], needle=o2},
      {haystack=[q1], needle=q2},
      {haystack=[xml1], needle=xml2}
  ];
  for(haystackAndNeedle in haystacksAndNeedles) {
	  writeOutput(arrayFind(haystackAndNeedle.haystack, haystackAndNeedle.needle) & ' ' & arrayFindAll(haystackAndNeedle.haystack, haystackAndNeedle.needle).toList() & ' ' & arrayContains(haystackAndNeedle.haystack, haystackAndNeedle.needle) & ' ' & arrayDelete(haystackAndNeedle.haystack, haystackAndNeedle.needle) & '<br>');
  }
</cfscript>
-----------

Actual Result:

1 1 YES YES
1 1 YES YES
1 1 YES YES
1 1 YES YES
1 1 YES YES
0 NO NO

Expected Result:

1 1 YES YES
1 1 YES YES
1 1 YES YES
1 1 YES YES
1 1 YES YES
1 1 YES YES

Related URL: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arrayfind.html

Related URL: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arrayfindall.html

Related URL: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraycontains.html

Related URL: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraydelete.html

Attachments:

Comments: