Cookie scope doesn't throw error while inserting struct directly

Issue happened on latest version of lucee & ACF also, It does not throwing any exception while write a struct directly to a cookie in the cookie scope. I’m checked with ACF11, ACF16 acts same way as lucee does.

Sample code :
variables.someStruct = {
‘Squirrels’: ‘Are totally cool’
};
cookie.squirrel_plain = variables.someStruct;
writeDump(cookie);

ACF returns :
[empty string]

Lucee returns :
Empty:null

If we add complex objects for array and query related value in cookie, it works fine but still fails for Struct.

Use Array to cookie :
Can’t cast Complex Object Type Array to String

Use Query to cookie :
Can’t cast Complex Object Type Query to String

Source : [LDEV-942] - Lucee

Trycf sample: TryCF.com

Please give any suggestions about this.

I have read the linked ticket and noticed Michael’s request for user comment. I can see that changing behaviour could possibly break existing code. However, I can’t quite think of why not failing would be benefit the user or be expected in any possible workaround that someone might have written in their app.

If you write to the cookie scope I think you are probably expecting to read that value as some point in the future and it’s not going to be available.