Bug: ListDeleteAt() error message shows wrong range limit

Came across this bug while running code on Lucee 6.1.0.243, it’s a bad error message from ListDeleteAt(), which when you use an out-of-bounds list index, gives you the wrong allowable range. For example:

<cfset my_list = "A,B,C,D,E">
<cfset my_list = ListDeleteAt(my_list,6)>

This will give the following error message:

“Invalid call of the function [ListDeleteAt], second Argument [index] is invalid, index must be an integer between 1 and 4”

No, the actual allowable range is 1-5.

I’ve tried this with a one-element list too, same thing happens, the high end of the stated range is 1 less than it should be, in this case zero:

<cfset my_list = "A">
<cfset my_list = ListDeleteAt(my_list,2)>

Error message: “Invalid call of the function [ListDeleteAt], second Argument [index] is invalid, index must be an integer between 1 and 0”

Looks like it’d be a very quick, trivially-easy fix in the underlying Lucee engine code. Just reporting it like a good citizen!

Looks like it happens here

1 Like

Just added a PR for this Update ListDeleteAt.java for correct error text pointing to the corre… by andreasRu · Pull Request #2428 · lucee/Lucee · GitHub

Has been a long time ago I’ve added PR. :smiley:

1 Like

Thanks andreas! It’s a small bug, but it’s good to fix it! I just found a much bigger bug with NumberFormat(), and I just reported that one too. Doing my best to help the project!