CGI-Scope weirdness

Description

CGI scope works fine, can be dumped, has a list of keys (line 1) and I can access variables (line 4).

.keyExists and StructKeyExists denies the existence of the key(s) though.

 

Output:


Possibly related to ?

Activity

Show:

Kai Koenig January 13, 2025 at 9:36 PM

Can confirm this is working as expected now in the snapshot build since 13/01/25

Brad Wood January 10, 2025 at 10:18 PM

Oh, another note-- the CGI scope is also special in that it never errors on a key that doesn’t exist. So cgi.foobar just returns an empty string. CF and Lucee will still return false for structKeyExists, even though the key can be accessed. I plan to match this as well.

Brad Wood January 10, 2025 at 9:59 PM

Yeah, the CGI scope is special and a little annoying. It doesn’t actually have any keys in it, but is just a proxy that goes and gets the data when you ask for it. As a result, it doesn’t always behave as expected. I had “fixed” the underlying Map.keySet() method recently to return the known set of CGI keys which fixed most weirdness. structKeyExists() uses Map.containsKey() under the hood, which doesn’t recognize the fake keys. is due to the same issue. The underlying Map.get() methods don’t find any actual keys, so when duplicating the scope, we are using the underlying Java methods which don't find the values.

Let me see if I can “trick” a few more of the underlying Map methods to get CGI working better.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created January 3, 2025 at 12:36 PM
Updated January 13, 2025 at 9:36 PM
Resolved January 10, 2025 at 10:41 PM