Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active December 7, 2022 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/5ebc08505eeb3edfbd54ebdaadc11b8f to your computer and use it in GitHub Desktop.
Save JamoCA/5ebc08505eeb3edfbd54ebdaadc11b8f to your computer and use it in GitHub Desktop.
Test to see if the read-only ColdFusion CGI scope can be cleared be reference.
<!--- 20220204
This is a test to see if the CGI scope can be cleared.
(I thought that the CGI scope was "read-only".)
Adobe ColdFusion allows it to be cleared by reference.
Lucee throws a "can't clear struct, struct is readonly" error.
GIST: https://gist.github.com/JamoCA/5ebc08505eeb3edfbd54ebdaadc11b8f
CFBUG: https://tracker.adobe.com/#/view/CF-4212734
THREAD: https://community.adobe.com/t5/coldfusion-discussions/cgi-scope-is-empty-with-coldfusion-2021-on-windows-2019/td-p/12634405
TRYCF: Unable to test on TryCF.com or CFFiddle as CGI scope is disabled.
BUGTRACKER: https://tracker.adobe.com/#/view/CF-4212734
NOTE: If you test this, you will need to restart the ColdFusion service or the CGI struct will continue to be
non-existent when dumped as a whole, but all vars still exist and return the correct.
--->
<cfdump var="#cgi#" expand="false" label="CGI (pre-clear)">
<cfscript>
function doStuff(struct sourceStruct){
local.s = arguments.sourceStruct;
structClear(local.s);
}
</cfscript>
<cfset doStuff(cgi)>
<cfdump var="#cgi#" label="CGI (post-clear)">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment