Hi,
found that PassBy="value" do not duplicate entire structure.
If I add array to a struct, and modify that structure in a function with argument passby="value"
My array also will be modified.
will return ["John","Jason","James", "TEST"]
Tryed to do <cfset data = duplicate(data)>
Works as expected, “combination” wont be modified
Tested on coldfusion 18 with <cfapplication passarraybyreference = "true | false">
works as expected.
Please add 3-rd case, when “Struct“ with “array” inside is passed to function:
, I think No need. Did you see the first case? . Because, first case also have struct with array example. So, the above case as same as the first case. Please check.
, sorry, I just saw that test passed, and that confused me.
when you consult the documentation for “duplicate“ https://docs.lucee.org/reference/functions/duplicate.html you will see that the function has 2 arguments, the second is of interest for us, “deepcopy“ that one is by default to true with the function “duplicate“, but false with “passby“.