Scary fun with variables scopes.

2007-10-05 Thread Ian Skinner
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:

RE: Scary fun with variables scopes.

2007-10-05 Thread Rich
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Charlie Griefer
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Janet MacKay
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Ron Gowen
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Janet MacKay
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Ron Gowen
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Janet MacKay
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Janet MacKay
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Claude Schneegans
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 --

Re: Scary fun with variables scopes.

2007-10-05 Thread Janet MacKay
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Claude Schneegans
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

RE: Scary fun with variables scopes.

2007-10-05 Thread Rich
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Claude Schneegans
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

Re: Scary fun with variables scopes.

2007-10-05 Thread Janet MacKay
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. ~|

Re: Scary fun with variables scopes.

2007-10-05 Thread James Holmes
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