I would upgrade CF to 7 or 8 it but it's client's decision, unfortunately:(
I have fixed that by changing variables scope to "this" scope. It works but
you know about the disadvantages of using this.instance rather than
variables.instance. It's just a fix to get it works but I'm not quite happy
and can't explain why variables.instance is visible from outside.

Michael

-----Original Message-----
From: Dale Fraser [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 16 October 2007 1:43 PM
To: CF-Talk
Subject: RE: Problem with using variables scope

Never seen that with 7 and now 8 and do that type of thing all the time.

If this is just 6, id say upgrade. Your right, it shouldn't happen.

Regards
Dale Fraser

http://learncf.com


-----Original Message-----
From: Michael Nguyen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 16 October 2007 2:25 PM
To: CF-Talk
Subject: Problem with using variables scope

Hi People,
I have encountered a very weird error with variables scope. 

<cfset var AnnouncementBean =
createObject("component","mypath.announcement").init(argumentcollection=argu
ments)/>
and 
<cfset var AnnouncementType =
createObject("component","mypath.announcementType").init(argumentcollection=
arguments)/>

Then I dump those two objects and found that the AnnouncementBean object is
the same as
AnnouncementType (it has properties and methods of AnnouncementType )
When I comment the creation of the second object then dump it, it show the
correct object.

I found that because 
<cfset variables.instance = StructNew() /> is declared in both objects
and when I created the second object, this  variables.instance overrides the
first
variables.instance was created in the first one.

To me, it's really really weird as the variables scope exists only within
that object.

Using CFMX 7 is ok, the CF6 causes this problem. I am running in Unix.

Any help is appreciated. 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291308
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to