Give this a try if you have a moment.
Put this code in a file test.cfm. Note: no cfapplication tag.
cfoutputSession.test: #session.test#/cfoutput
cfif session.test EQ true
Session Variable evaluated true.
/cfif
Then call the page with this url:
Ian,
ColdFusion is evaluating the line cfif session.test EQ true and is looking
through all known scopes and is finding URL['session.text'], treating it as
a variable name, which is evaluating to true. Ben Nadel discussed this type
of non-assertive scope reference in a recent blog post
add this:
cfoutput#isSimpleValue(session.test)#/cfoutput -- YES
cfdump var=#session# -- error
which is weird because as of CFMX, creating a variable with a dot in
the name will implicitly create a struct (soo cfset foo.bar = 123
/ would create a struct named 'foo' with a key named 'bar' and
Does this work for anyone if the variable name is something other than session?
a href=test.cfm?test.foo=bartest.bar=fooid=2Test/a
~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active
I tried it, and dumped session: test is not there, you must have created
another struct named session, I tried dumping variables it is not there?
On 10/5/07, Ian Skinner [EMAIL PROTECTED] wrote:
Give this a try if you have a moment.
Put this code in a file test.cfm. Note: no cfapplication
I don't think its a structure. Just a variable name with a . in it.
Nm. I see Charlie Griefer already explained that :)
~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and
seems it creates a struct called session in the url scope: cfdump
var=#url# /
On 10/5/07, Ron Gowen [EMAIL PROTECTED] wrote:
I tried it, and dumped session: test is not there, you must have created
another struct named session, I tried dumping variables it is not there?
On 10/5/07, Ian
I tried it, and dumped session: test is not there, you must have created
another struct named session, I tried dumping variables it is not there?
Its not a structure, but you'll see it if you dump the url scope.
~|
Get involved
seems it creates a struct called session in the url scope: cfdump
var=#url# /
I don't think its a structure. Just a variable name with a . in it.
~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax
I don't think its a structure. Just a variable name with a . in it.
But this is unconsistent with the way CF really works:
Try CFSET test.test = 0
CFDUMP var=#test#
CFDUMP shows that test is a structure with a variable test, not a
variable test.test
--
But this is unconsistent with the way CF really works:
Try CFSET test.test = 0
CFDUMP var=#test#
CFDUMP shows that test is a structure with a variable test, not a
variable test.test
But I guess that's the point. Its not a structure in this case. Dump #URL# and
the value is not shown as a
But I guess that's the point. Its not a structure in this case. Dump
#URL# and the value is not shown as a structure. Its a simple value ie
test.test.
That's not only the point, it is also an issue, since in theory,
variable cannot have dots in their names.
So CF is actually creating an
I don't think its a structure. Just a variable name with a . in it.
But this is unconsistent with the way CF really works:
Try CFSET test.test = 0
CFDUMP var=#test#
CFDUMP shows that test is a structure with a variable test, not a
variable test.test
The way CF really works in the
CF cannot create it so it treats it as a
variable session.test that it places into the URL scope.
And this is what is inconsistent, since a variable cannot have a dot in
its name.
--
___
REUSE CODE! Use custom tags;
See
You will see that the exact same phenomenon occurs; when the struct already
exists, CF cannot implicitly create it and creates a variable with the name
provided.
It doesn't seem to matter whether a structure exists or not.
~|
You can, of course, protect yourself from this:
cfif StructKeyExists(session, test) AND session.test EQ true
Session Variable evaluated true.
/cfif
On 10/5/07, Ian Skinner [EMAIL PROTECTED] wrote:
Give this a try if you have a moment.
Put this code in a file test.cfm. Note: no
16 matches
Mail list logo