I'm working on moving our apps from a ACF11 (don't...
# cfml-general
b
I'm working on moving our apps from a ACF11 (don't ask) to ACF2021. I've run into several instances of the unscoped variables issue, but one that I'm not sure is related deals with a cfajaxproxy call to a cfc. There is a session scoped variable that the cfc needs but it appears the cfc no longer has access to any of the session variables. Has anyone else run into this yet and, if so, how did you solve it?
d
My understanding is that the change requires all variable references to be explicitly scoped, so I'd think you could reference them as session.foo. That's not working?
b
Sadly, it is not. It doesn't appear to have access to any of the session variables. One of the error messages that I've received was, "Variable SESSION is undefined" and I checked for the SessionID and that's not available either.
d
Smells weird, but I haven't worked with cfajaxproxy much, maybe not at all. I assume this is in dev, in which case, first I'd add the jvm arg to turn implicit scope search back on, and see if that fixes your issue. Then I'd build a minimal test case, and post it here, and/or send it to Adobe, see if anyone can confirm or figure anything else out.
👍 1
r
maybe session won't created if there's no explicit session setting in application.cfc for those called cfcs? Just thinking aloud. If ajaxproxy calls some cfc remotely, which application.cfc is used for those cfcs?
1
m
Roddy just said what I was going to say. Make sure sessions are on. Try dumping the entire session scope and see if that returns anything at all. Then explicitly set a session var and dump the entire scope.
👍 1
m
You should also try and dump GetApplicationMetadata(), to obtain info on what's going on with your webservice - I suspect that your cfajaxproxy endpoint may reside somewhere outside of your application, which may be the reason why SESSION is not defined there. This could happen, for instance, if this endpoint resides in an aliased directory, so the Application.cfc of your webroot doesn't take there. I seem to remember that this was no issue for us back in the days of CF8 and JRun, but we had to find workarounds to this alias problem when we moved to Tomcat/Lucee - so instead of alias directives in our Apache config, we now use either symlinks or bind mounts, depending on the requirements.
b
The name is set and session management is turned on in the application.cfc for the app. The cfc being called from the cfajaxproxy is outside of the app, but that's never been an issue before. It's being referenced with dot path notation, not using aliases or mappings, for better or worse. Also, I'm guessing because it's an ajax call, cfdump doesn't work even if I follow it with a cfabort. I'm able to write simple variables to the log sometimes, which is how I confirmed it's not seeing any session variables. We're going to try adding the jvm arg next to see what that does and I'll report back with the results.
👍 1
s
Adding this setting to Application.cfc will revert ACF back to the old var scoping: <!--- Needed to support non-scoped variables ---> <cfset this.searchimplicitscopes = true> For the session scoping, if your CFC's are in a different folder, it may have it's own Application.cfc. Verify that the folder version has the same this.name value as the parent.
b
I added the jvm argument in the cf admin and restarted the server. No change. The application and the cfc are in different folders at the same level, but the folder for the cfc does not have an application.cfc on either the not-working dev server or the old, but working, CF11 server.
r
"but the folder for the cfc does not have an application.cfc" - maybe it will work if you create one, with some unique this.name value and this.sessionManagement=true
b
@rodyon It can't hurt to try!
d
Don't make that name unique if you want it to share application space, session etc, with other parts of the app.
🤔 1