arrayAppend/prepend with same array throws StackOverflowError

Description

array append/prepend(), using the same array as an object was throws StackOverflowError. Seems ACF works fine. merge to true returns result as expected.

<cfscript> arr = [1,2,3]; arrayAppend(arr, arr); writeDump(arr); </cfscript>

Stacktrace

lucee.runtime.exp.NativeException: java.lang.StackOverflowError at java.util.AbstractList.hashCode(Unknown Source) at java.util.AbstractList.hashCode(Unknown Source) at java.util.AbstractList.hashCode(Unknown Source) at java.util.AbstractList.hashCode(Unknown Source) at java.util.AbstractList.hashCode(Unknown Source)

Environment

None

Activity

Show:

Michael Offner 21 February 2022 at 19:22

Zac Spitzer 6 February 2022 at 19:45

Pothys - MitrahSoft 1 December 2021 at 14:24

Now the array append with same array works fine and didn't throws StackOverflowError. But using serializeJSON(), deserializeJSON() with that array has a incompatibility with ACF. And also using .toString() throws StackOverflowError. I updated a testcase to point out above issues in PR here: https://luceeserver.atlassian.net/browse/LDEV-3333?focusedCommentId=49906

arr = [1,2,3]; arr.append(arr); arr.toString(); // throws StackOverflowError

Michael Offner 29 November 2021 at 14:10

https://github.com/lucee/Lucee/commit/73eca62436ead556c23fa3f813983970efa917a4

 

please check if the build solves the issue

Pothys - MitrahSoft 12 October 2021 at 06:36

Yes , using duplicate function works fine.

<cfscript> arr = [1,2,3]; arrayAppend(arr, duplicate(arr)); writeDump(arr); </cfscript>
Duplicate

Details

Assignee

Reporter

Priority

Labels

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

Created 8 October 2021 at 15:17
Updated 21 February 2022 at 19:22
Resolved 21 February 2022 at 19:22

Flag notifications