Bug? CGIReadOnly always true (Admin setting disregarded in application.cfm apps)

Can someone confirm this as a bug please? Shall I add a ticket?

Bug
The Lucee Server/Web Administrator setting CGIReadOnly (Settings / Scope / CGI read only) is not properly inherited to applications using an Application.cfm, it is always true: getApplicationSettings().cgiReadOnly. As a result, all CGI writes causing the error: can't set key [foo] to struct, struct is readonly

Reproduce
Set CGI read only to Writable and call this Application.cfm:

<cfapplication name="foobar">
<cfdump var="#getApplicationSettings().cgiReadOnly#">
<cfparam name="CGI.foo" default="xyz">

The source causes the error: can't set key [foo] to struct, struct is readonly

Workaround
Explicitly set the value in the application.cfm.

<cfapplication cgiReadOnly="false" ... >

The workaround i fine for me, the post is for others having the same problem.

sure, file a bug and link it to this issue

https://luceeserver.atlassian.net/browse/LDEV-372

https://luceeserver.atlassian.net/browse/LDEV-3841

1 Like

Is this broken again in the 6.x series of Lucee?

I can’t set this in admin nor programatically using:

this.cgiReadOnly = false;
cgi.test = 10;

throws an error?

|Loader Version|6.2.0.7-SNAPSHOT|
|Servlet Container|Apache Tomcat/9.0.89|
|Java|11.0.23 (Eclipse Adoptium) 64bit|
|Host Name|localhost|
|OS|Windows 11 (10.0) 64bit|
|Architecture|64bit|
|Mode|Multi|

hmmm, I just refactored the test, seems ok to me?

@dawesi what’s the error stacktrace look like?

Error:
Message : can't set key [test] to struct, struct is readonly

Error Screensho on Dropbox

application.cfc
component {

    this.name = "cgitest";

    this.cgiReadOnly = false;
    cgi.test = 10;

    }

in application.cfc

admin panel also does not save this setting, haven’t tried cfadmin yet

hmmm, can you try that not in the constructor? so in onRequestStart()

I’m seeing the value being being correctly updated in .CFConfig.json, but the admin is being passed the wrong state, can you file a bug about this for me while I fix it?

https://luceeserver.atlassian.net/browse/LDEV-5392

fixed the admin not updating the setting visually in 6.2.1.57-SNAPSHOT

2 Likes

I need it before that, I am using it immediately to inform my framework of an api flag set in a component that application.cfc extends : ie:

component extends="teamcfml.core.v21.000.app" tc:type="app:api:rest"  tc:version="3.0" {

so do this even before onAppStart… while there are other ways to skin this cat, I want to keep config in application.cfc to a minimum for each tenant on this multi-tenant framework. So code executes at top of app.cfc from extends above

It works for me, if I set the setting in the admin?