tracker issue : CF-4204053

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

Listappend does not return the list unchanged when you add an empty string

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

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

Created: 02/27/2019

Components: Language, Functions

Versions: 2016,2018

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Updater 7, Updater 8, Updater 9 / CF2018U5

Priority/Frequency: Normal / All users will encounter

Locale/System: ALL / Win 2012 Server x64

Vote Count: 0

Problem Description:

Documentation:
Listappend returns

A copy of the list_,_ with value appended. If value = "", returns a copy of the list, unchanged.

Listappend does not return the list unchanged when you add an empty string! It returns a "," appended

Steps to Reproduce:

{code:java}
<cfset list = "test">
<cfset list = listappend(list, "")>
<cfoutput>---#list#</cfoutput>
{code}


Actual Result:
test,
Expected Result:
test
Any Workarounds:
Do not append empty values to listappend

Attachments:

Comments:

Hi Oliver, # We need to update the docs which states "If value = "", returns a copy of the list, unchanged." # If we return copy of list unchanged when empty value is appended, then it might break other list function where includeEmptyFields parameter is used. Example : ListLen(),ListGetAt().   Thanks, Mukesh
Comment by Mukesh K.
30648 | April 23, 2019 08:15:42 AM GMT