I have - in the past - had problems managing session
variables with
constructs like this:
<cfif isDefined("session.foo")>
<cfoutput>#session.foo#</cfoutput>
</cfif>
Where the isDefined() expression was true, but the following
line errored
with "variable does not exist".
It was only with session variables that this happenend.
We changed to using structKeyExists(), and the problem went
away. This was
back in CFMX6x, and have never used isDefined() since, so not
sure if the
problem still persists.
This does not help your situation, but is perhaps
confirmation that there
is something flaky about the session scope, and how CF
determines the
existence of variables in it.
I don't know how the error template stuff works... is it a
separate request
(ie: are things like Application.cfm executed again?). Could
the variable
somehow be getting set between the time the error is thrown
and when the
<cfdump> is emailed to you?
Does the error always crop up at the same piece of code /
same variable, or
could it be any session variable, at various different places
in your code?
--
Adam