Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): M Bean / M Bean (M Bean)
Created: 11/20/2014
Components: Documentation
Versions: 10.0
Failure Type: Usability Issue
Found In Build/Fixed In Build: Final /
Priority/Frequency: Minor / Some users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 0
Problem Description:
ListInsertAt() crashes for some seemingly valid inputs. Documentation at http://help.adobe.com/livedocs/coldfusion/8/htmldocs/help.html?content=functions_l_13.html doesn't specify this special case. Apparently if the index is 1 higher than the size of the list, it crashes. This is contrary to what you might think it might logically do since the case makes sense, especially if the list was just initialized and a loop is adding to the list list 1 element at a time.
Steps to Reproduce:
Run either of the the following code snippets:
<cfset local.test = "" />
<cfset local.result = ListInsertAt(local.test, 1, "something") />
<cfset local.test = "1" />
<cfset local.result = ListInsertAt(local.test, 2, "something") />
Actual Result:
An error : "In function ListInsertAt(list, index [, delimiters]), the value of index, 1, is not a valid as the first argument (this list has 0 elements). Valid indexes are in the range 1 through the number of elements in the list."
Expected Result:
ListInsertAt() call should return "something" or "1,something".
Any Workarounds:
Pull out first iteration of any loop before allowing loops to run (complicates logic). Call ListAppend() when index will be last.
Call ListPrepend if index will always be 1.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3855211
External Customer Info:
External Company:
External Customer Name: bean5b
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: