Adam Cameron
a = [1,2,3]
a.each((cookie) => {
writeDump(cookie)
})
I've used a dumb variable name there (in the actual code I was looking over cookie values, so it made more sense 😉), but still.. I would expect 1,2,3
(and that's what I get on CF), but on Lucee I get three dumps of the cookie scope.
I think CF's behaviour is legit... my own variable should take precedence over inbuilt ones (even if they "hide" the inbuilt ones).
It was an edge case though and easily solved. Still... it's a CF incompat so should probably be addressed?Adam Cameron
bdw429s
02/25/2022, 8:23 PMcookie
websolete
02/25/2022, 8:24 PMbdw429s
02/25/2022, 8:43 PMurl.foo
, it will never scope hunt for variables.url.foo
etc, it will just take it directly. Adobe is more lax about allowing you to have variables.url
or variables.cookie
. I think this is a documented compat for security or performance or whatever.bdw429s
02/25/2022, 8:47 PMbdw429s
02/25/2022, 8:48 PMIn Lucee Server Scopes are always invoked first, which means all scope names, e.g. variables, url, form, session, application... are effectively reserved words. Lucee resolves scopes before a variable with the same name, so they can't be referenced/reached.
bdw429s
02/25/2022, 8:48 PMapplication = 1;
dump( application ); // returns the application struct (not 1)
bdw429s
02/25/2022, 8:49 PMAdam Cameron
bdw429s
02/25/2022, 8:52 PMarguments.cookie
but then not do any scoping hunting on it. That part I'm unclear if it's be design or just an accident.bdw429s
02/25/2022, 8:53 PMarguments.cookie
works, but it's a bit of a pothole for you to step in.bdw429s
02/25/2022, 8:53 PMcookie
scope inside your UDF it would appear.Adam Cameron
cookie
- which I did, let's face it - then that should be my call. I'm a grown-up and I know the ramifications of it.
I'd really prefer all this global shit (various scopes) not even be accessible beyond top-level .cfm files at all. But I'm 20yrs too late for that suggestion 😉