Issues

Select view

Select search mode

 

User defined Application scope, session scope variables not in memory for templates

Description

I having the same 2 problems on 5.2.7.63 and 5.2.8.50.

1 - onApplicationStart does not execute (solved with code in onSessionStart)
2 - user defined variables in Application and Session scope are not defined in templates

Session storage is set to memory
I do not see a comparable setting in lucee to acf enable application variables, enable session variables

Each request executes the initialization code in Application.cfc and whatever function is called for.
a - unmodified code for new session executes

  • initialization code is executed [ this.xxx ]

  • onApplicationStart is NOT executed

  • onSessionStart [ user defined Application scope variables not in memory] - error

b - modified onSessionStart code to run onApplicationStart

/* onApplicationStart not running */ if ( ! structKeyExists(application,"appCode") ) { WriteLog( text="start code execute onApplicationStart if user variables not in scope", type="information", application="true", file="Testing" ); onApplicationStart(); WriteLog( text="end code execute onApplicationStart if user variables not in scope", type="information", application="true", file="Testing" ); }

c - modified code for new session

  • initialization code is executed [ this.xxx ]

  • onSessionStart [ user defined Application scope variables not in memory]

  • code executes onApplicationStart

  • continue onSessionStart [ user defined Application scope variables in memory]

  • onRequestStart [ user defined Application and Session scope variables in memory]

  • template [ user defined Application and Session scope variables not in memory , Standard Session scope variables are in memory - e.g., cfid, sessionid ] - error

d - modified code for same session executes

  • initialization code is executed [ this.xxx ]

  • onRequestStart [ user defined Application and Session scope variables in memory]

  • template [ user defined Application and Session scope variables not in memory , Standard Session scope variables are in memory - e.g., cfid, sessionid ] - error

I’ve tried with Session type Application and JEE, no difference

Attachments

3
  • 23 Jul 2018, 04:23 pm
  • 23 Jul 2018, 04:23 pm
  • 23 Jul 2018, 04:23 pm

relates to

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Priority

Created 23 July 2018 at 16:41
Updated 9 September 2019 at 13:48

Activity

Show:

Martie Henry24 July 2018 at 13:26
Edited

I was able to solve this problem by doing the following

  1. Lucee Server Admin: sessionType="jee"

  2. rewrite ACF application.cfc in several steps

    • change this.xxx to xxx for all user defined variables not related to CFML, <snips>:

    original code: if (CGI.HTTPS == "on") { this.http = "https://"; } else { this.http = "http://"; } this.host = CGI.SERVER_NAME; this.port = CGI.SERVER_PORT; this.base = this.http & this.host; this.isLocal = false; switch (ucase(this.host)) { case "LOCALHOST": case "127.0.0.1": case "10.0.0.1": this.isLocal = true; break; } if (this.isLocal && this.port != "80") { this.base = this.base & ":" & this.port; } new code: if (CGI.HTTPS == "on") { http = "https://"; } else { http = "http://"; } host = CGI.SERVER_NAME; port = CGI.SERVER_PORT; base = http & host; isLocal = false; switch (ucase(host)) { case "LOCALHOST": case "127.0.0.1": case "10.0.0.1": isLocal = true; break; } if (isLocal && port != "80") { base = base & ":" & port; }
    • export lucee server admin to applicationLucee.cfc

    • compare settings in applicationLucee.cfc and application.cfc. remove CFML not in applicationLucee.cfc, add any missing CFML from applicationLucee.cfc, <snips>

    applicationLucee.cfc // session handling enabled or not this.sessionManagement = true; // cfml or jee based sessions this.sessionType = "jee"; // untouched session lifespan this.sessionTimeout = createTimeSpan( 0, 1, 0, 0 ); this.sessionStorage = "memory"; // client scope enabled or not this.clientManagement = true; this.clientTimeout = createTimeSpan( 0, 1, 0, 0 ); this.clientStorage = "memory"; // using domain cookies or not this.setDomainCookies = false; this.setClientCookies = false; ACF application.cfc this.sessionManagement = "true"; this.sessionTimeout = CreateTimeSpan(0,1,0,0); //1 hours this.loginStorage = "Session"; // !!! not in lucee this.setClientCookies = false; if (isLocal) { this.enableRobustException = true; this.errorDetail = true; } else { this.enableRobustException = false; this.errorDetail = false; } new application.cfc // session handling enabled or not this.sessionManagement = true; // cfml or jee based sessions this.sessionType = "jee"; // untouched session lifespan this.sessionTimeout = createTimeSpan( 0, 1, 0, 0 ); this.sessionStorage = "memory"; // client scope enabled or not this.clientManagement = true; this.clientTimeout = createTimeSpan( 0, 1, 0, 0 ); this.clientStorage = "memory"; // using domain cookies or not this.setDomainCookies = false; this.setClientCookies = false; if (isLocal) { this.enableRobustException = true; this.errorDetail = true; } else { this.enableRobustException = false; this.errorDetail = false; }
    • correct syntax of mappings

    original code: pathSep = iif(SERVER.os.name eq "UNIX",de("/"),de("\")); //Set path delimiter for client os dir = getDirectoryFromPath(getCurrentTemplatePath()); this.mappings["/SP"] = dir; this.mappings["/SPorm"] = dir & "externals" & pathSep & "orms"; this.mappings["/SPservices"] = dir & "services"; if ( isMobile ) { this.mappings["/SPapi"] = dir & "api"; this.mappings["/SPmethods"] = dir & "methods"; this.mappings["/SPaur"] = dir & "aur"; } new code: pathSep = iif(SERVER.os.name eq "UNIX",de("/"),de("\")); //Set path delimiter for client os dir = getDirectoryFromPath(getCurrentTemplatePath()); this.mappings["/SP"] = {physical:"#dir#"}; this.mappings["/SPorm"] = {physical:"#dir#externals#pathSep#orms"}; this.mappings["/SPservices"] = {physical:"#dir#services"}; if ( isMobile ) { this.mappings["/SPapi"] = {physical:"#dir#api"}; this.mappings["/SPmethods"] = {physical:"#dir#methods"}; this.mappings["/SPaur"] = {physical:"#dir#aur"}; }

Flag notifications