arraySlice()/querySlice() with offset 0 throws StackOverflowError

Description

Using arraySlice() function, if the array is empty and the offset is 0 means it throws StackOverflowError. ACF throws an error like Cannot access array element at position 0. https://trycf.com/gist/459d8196c82d86b38113f5429917a0b3/acf2021?theme=monokai

Using empty query with offset 0 in querySlice() also throws StackOverflowError. ACF throws an error like The slice offset 0 is out of bounds. https://trycf.com/gist/84cc8541441ce5e4068827d82e74950f/lucee5?theme=monokai
It would be nice to throw an error like the array/query cannot be empty.

StackTrace

ArraySlice() lucee.runtime.exp.NativeException: java.lang.StackOverflowError at lucee.runtime.type.wrap.ListAsArray.size(ListAsArray.java:438) at lucee.runtime.functions.arrays.ArraySlice.call(ArraySlice.java:42) at lucee.runtime.functions.arrays.ArraySlice.call(ArraySlice.java:53) at lucee.runtime.functions.arrays.ArraySlice.call(ArraySlice.java:53) QuerySlice() lucee.runtime.exp.NativeException: java.lang.StackOverflowError at lucee.runtime.functions.query.QuerySlice.call(QuerySlice.java:43) at lucee.runtime.functions.query.QuerySlice.call(QuerySlice.java:54) at lucee.runtime.functions.query.QuerySlice.call(QuerySlice.java:54)

Environment

None

Activity

Show:

Pothys - MitrahSoft 6 December 2021 at 12:28

I've checked this ticket with the lucee latest build 6.0.0.144-SNAPSHOT and now arraySlice()/querySlice() with empty array/query throws error like cannot be empty instead of StackOverflowError.

https://github.com/lucee/Lucee/commit/50775e503522815addbd72f99749539055ed3198

Pothys - MitrahSoft 18 November 2021 at 13:56

I added a fix to this ticket

Pull Request: https://github.com/lucee/Lucee/pull/1465

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Affects versions

Created 18 November 2021 at 12:07
Updated 27 April 2022 at 16:51
Resolved 6 December 2021 at 12:29

Flag notifications