ListFirst() function not compat with acf

Description

https://trycf.com/gist/8f0f0eaa4e46ea74e0c4a33187ba6353/lucee6-beta?theme=monokai
In the listFirst() function, it takes a "," delimiter value when the delimiter argument is set to empty. But ACF takes empty delimiter value.

Attachments

1
  • 29 Jun 2023, 06:16 pm

Activity

Show:

Pothys - MitrahSoft 30 June 2023 at 08:12

I added a testcase for this ticket.
PR : https://github.com/lucee/Lucee/pull/2148

Brad Wood 29 June 2023 at 18:16

It seems to me that both Adobe AND Lucee are wrong here. In CFML, when using an empty delimiter on a list, the string is broken up with each character as a separate item. i.e.

"dev,LAS,lucee".listToArray("")

returns the array

So in order to be consistent,

"dev,LAS,lucee".listFirst("")

should return the single letter d. It’s also worth noting these two lines should always return the same value!

"dev,LAS,lucee".listFirst("") "dev,LAS,lucee".listToArray("").first()

IMO Lucee should not be following Adobe’s incorrect functionality.

I have entered a ticket for Adobe to fix their behavior:

https://tracker.adobe.com/#/view/CF-4218463

Also, Related ticket:

https://tracker.adobe.com/#/view/CF-4213571

Zac Spitzer 29 June 2023 at 15:42
Edited

listLast is affected as well

the old empty string is null, thus falls back to default problem

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Priority

Created 29 June 2023 at 15:38
Updated 6 March 2025 at 11:29

Flag notifications