<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Be careful with the &#8216;local&#8217; scope when migrating from CF8 to CF9</title>
	<atom:link href="http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/</link>
	<description>Random Thoughts of a Techno-Hermit</description>
	<lastBuildDate>Mon, 30 Jan 2012 21:07:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Michael Bragg</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-624</link>
		<dc:creator>Michael Bragg</dc:creator>
		<pubDate>Tue, 06 Apr 2010 19:42:49 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-624</guid>
		<description>I too have been in the habit for years of using  at the top of each function and pass almost everything around in this structure within each function, then pass that structure - or portion of that structure - out as a result. 

In the process of upgrading a development box to CF9 (preparing to move the production machines to CF9) I found that some references to complex data types (nested structs, or a query in a struct) can no longer be referenced reliably ie: &quot;local.query.recordCount&quot; in CF9... this stinks. And it&#039;s one of those &quot;sometimes it works, sometimes it breaks&quot; kind of bugs.

Changing the name of the &quot;var-previously-known-as-local&quot; to something else (like &quot;result&quot; or &quot;my&quot;) in the cfset fixes the problem. (Both are poor names to replace &quot;local&quot;)

BTW - I&#039;ve applied the Hot Fix 1, still had the same problem until I renamed my &quot;var&#039;d variable&quot;.

Now I just have to decide what is a suitable variable name to replace &quot;local&quot;, and fire up trusty old Dreamweaver to do a mass search and (delicate) replace...</description>
		<content:encoded><![CDATA[<p>I too have been in the habit for years of using  at the top of each function and pass almost everything around in this structure within each function, then pass that structure &#8211; or portion of that structure &#8211; out as a result. </p>
<p>In the process of upgrading a development box to CF9 (preparing to move the production machines to CF9) I found that some references to complex data types (nested structs, or a query in a struct) can no longer be referenced reliably ie: &#8220;local.query.recordCount&#8221; in CF9&#8230; this stinks. And it&#8217;s one of those &#8220;sometimes it works, sometimes it breaks&#8221; kind of bugs.</p>
<p>Changing the name of the &#8220;var-previously-known-as-local&#8221; to something else (like &#8220;result&#8221; or &#8220;my&#8221;) in the cfset fixes the problem. (Both are poor names to replace &#8220;local&#8221;)</p>
<p>BTW &#8211; I&#8217;ve applied the Hot Fix 1, still had the same problem until I renamed my &#8220;var&#8217;d variable&#8221;.</p>
<p>Now I just have to decide what is a suitable variable name to replace &#8220;local&#8221;, and fire up trusty old Dreamweaver to do a mass search and (delicate) replace&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Hayes</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-623</link>
		<dc:creator>Joe Hayes</dc:creator>
		<pubDate>Tue, 06 Apr 2010 17:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-623</guid>
		<description>See this post:
http://www.bytestopshere.com/post.cfm/major-flaw-in-cf9-may-break-code

...and the corresponding bug report:
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=80621

Should be fixed under hotfix 1, but I haven&#039;t verified (see bug 80621):
http://kb2.adobe.com/cps/825/cpsid_82536.html</description>
		<content:encoded><![CDATA[<p>See this post:<br />
<a href="http://www.bytestopshere.com/post.cfm/major-flaw-in-cf9-may-break-code" rel="nofollow">http://www.bytestopshere.com/post.cfm/major-flaw-in-cf9-may-break-code</a></p>
<p>&#8230;and the corresponding bug report:<br />
<a href="http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=80621" rel="nofollow">http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=80621</a></p>
<p>Should be fixed under hotfix 1, but I haven&#8217;t verified (see bug 80621):<br />
<a href="http://kb2.adobe.com/cps/825/cpsid_82536.html" rel="nofollow">http://kb2.adobe.com/cps/825/cpsid_82536.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russ Michaels</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-594</link>
		<dc:creator>Russ Michaels</dc:creator>
		<pubDate>Thu, 04 Mar 2010 17:34:52 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-594</guid>
		<description>What you probably do not realise as well is that using &quot;local&quot; to scope your variables also has other issues that exist prior to CF9. 
If you store a query in the scope, e.g.

Then you can have problems working with this query while it is in this scope. It took me quite some time to work out why my queries were going screwy, but as a result I had to change all my scoping to LOCALS instead of LOCAL to resolve the problem.
I do not recall what the exact problem was as it was a couple of years ago, so wa son CF6 or 7.</description>
		<content:encoded><![CDATA[<p>What you probably do not realise as well is that using &#8220;local&#8221; to scope your variables also has other issues that exist prior to CF9.<br />
If you store a query in the scope, e.g.</p>
<p>Then you can have problems working with this query while it is in this scope. It took me quite some time to work out why my queries were going screwy, but as a result I had to change all my scoping to LOCALS instead of LOCAL to resolve the problem.<br />
I do not recall what the exact problem was as it was a couple of years ago, so wa son CF6 or 7.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-572</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Mon, 15 Feb 2010 17:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-572</guid>
		<description>Michael,

From what I heard from Rupesh Kumar, CFThread runs as a function call, so it might be getting confused between the two local scopes (the one inside the CFThread and the one inside the CFFunction). I&#039;ll have to do some testing on that.</description>
		<content:encoded><![CDATA[<p>Michael,</p>
<p>From what I heard from Rupesh Kumar, CFThread runs as a function call, so it might be getting confused between the two local scopes (the one inside the CFThread and the one inside the CFFunction). I&#8217;ll have to do some testing on that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Skaggs</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-564</link>
		<dc:creator>Dan Skaggs</dc:creator>
		<pubDate>Tue, 09 Feb 2010 05:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-564</guid>
		<description>@lachdav You are correct, the variables you define are not put into the new local scope automatically unless you use the VAR keyword or assign them to local.x. Ray Camden wrote &lt;a href=&quot;http://www.coldfusionjedi.com/index.cfm/2010/2/8/Repeat--ColdFusion-9-does-NOT-remove-the-need-to-var-scope&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt; covering that very thing earlier today.  However since my code was doing &lt;cfset var local = structNew() /&gt; that should have created a Local.local structure. My return statement in those functions merely said cfreturn local which should have returned the entire local scope, not just my individual structure.  The fact that it was sometimes returning the structure named differently was the key to the problem I was having.  Once I changed from using &quot;local&quot; as my variable name to using &quot;ret&quot; the ambiguity went away and the application started working correctly again.</description>
		<content:encoded><![CDATA[<p>@lachdav You are correct, the variables you define are not put into the new local scope automatically unless you use the VAR keyword or assign them to local.x. Ray Camden wrote <a href="http://www.coldfusionjedi.com/index.cfm/2010/2/8/Repeat--ColdFusion-9-does-NOT-remove-the-need-to-var-scope" target="_blank" rel="nofollow">this post</a> covering that very thing earlier today.  However since my code was doing &lt;cfset var local = structNew() /&gt; that should have created a Local.local structure. My return statement in those functions merely said cfreturn local which should have returned the entire local scope, not just my individual structure.  The fact that it was sometimes returning the structure named differently was the key to the problem I was having.  Once I changed from using &#8220;local&#8221; as my variable name to using &#8220;ret&#8221; the ambiguity went away and the application started working correctly again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lachdav</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-563</link>
		<dc:creator>lachdav</dc:creator>
		<pubDate>Tue, 09 Feb 2010 01:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-563</guid>
		<description>I may misunderstand what you&#039;re saying, but I don&#039;t believe the new &#039;Local&#039; scope is implicit, nor are variables placed there by default. The default scope is still the Variables scope. To make a variable part of the Local scope, you either have to &#039;var&#039; it or explicitly place it in the local scope (local.myVar = 123).</description>
		<content:encoded><![CDATA[<p>I may misunderstand what you&#8217;re saying, but I don&#8217;t believe the new &#8216;Local&#8217; scope is implicit, nor are variables placed there by default. The default scope is still the Variables scope. To make a variable part of the Local scope, you either have to &#8216;var&#8217; it or explicitly place it in the local scope (local.myVar = 123).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Horne</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-561</link>
		<dc:creator>Michael Horne</dc:creator>
		<pubDate>Mon, 08 Feb 2010 16:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-561</guid>
		<description>I was beginning to think it was just me! Totally unable to describe the error!

I&#039;ve found another &#039;gotcha&#039;:
If you use CFTHREAD and within that tag you have references to the local scope (this includes functions called within the thread), the LOCAL scope is destroyed. You can literally have:

#local.wibble#

and under certain circumstances, wibble will be undefined in local!

Again, I&#039;ve been searching for this error online but no-one else seems to have it.

It appears the local scope isn&#039;t quite as safe as it seemed.</description>
		<content:encoded><![CDATA[<p>I was beginning to think it was just me! Totally unable to describe the error!</p>
<p>I&#8217;ve found another &#8216;gotcha&#8217;:<br />
If you use CFTHREAD and within that tag you have references to the local scope (this includes functions called within the thread), the LOCAL scope is destroyed. You can literally have:</p>
<p>#local.wibble#</p>
<p>and under certain circumstances, wibble will be undefined in local!</p>
<p>Again, I&#8217;ve been searching for this error online but no-one else seems to have it.</p>
<p>It appears the local scope isn&#8217;t quite as safe as it seemed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Skaggs</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-560</link>
		<dc:creator>Dan Skaggs</dc:creator>
		<pubDate>Mon, 08 Feb 2010 16:07:33 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-560</guid>
		<description>@Kev Yeah, that&#039;s what I thought too. But I would have thought it would have failed every time that way, rather than the roughly 60/40 split I was seeing. The good news is that the fix worked, the bad news is that my testing regimen for moving sites from CF8 to CF9 is going to need updating.</description>
		<content:encoded><![CDATA[<p>@Kev Yeah, that&#8217;s what I thought too. But I would have thought it would have failed every time that way, rather than the roughly 60/40 split I was seeing. The good news is that the fix worked, the bad news is that my testing regimen for moving sites from CF8 to CF9 is going to need updating.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Big Mad Kev</title>
		<link>http://www.tntechnohermit.com/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/comment-page-1/#comment-559</link>
		<dc:creator>Big Mad Kev</dc:creator>
		<pubDate>Mon, 08 Feb 2010 15:07:10 +0000</pubDate>
		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355#comment-559</guid>
		<description>Dan, off the top of my head I think if you code had the variable local set it would then set it as local.local. I remember some talk of this around the public beta.

Mr Forta has info on it here: http://forta.com/blog/index.cfm/2009/6/21/The-New-ColdFusion-LOCAL-Scope

&quot;It&#039;s clean, it&#039;s simple, it&#039;s intuitive, and it&#039;s fully backwards compatible. And yes, if you have a variable named &quot;local&quot; it&#039;ll still work, the variable will just become LOCAL.local, and as the LOCAL scope is in the default evaluation chain it&#039;ll just work.&quot;</description>
		<content:encoded><![CDATA[<p>Dan, off the top of my head I think if you code had the variable local set it would then set it as local.local. I remember some talk of this around the public beta.</p>
<p>Mr Forta has info on it here: <a href="http://forta.com/blog/index.cfm/2009/6/21/The-New-ColdFusion-LOCAL-Scope" rel="nofollow">http://forta.com/blog/index.cfm/2009/6/21/The-New-ColdFusion-LOCAL-Scope</a></p>
<p>&#8220;It&#8217;s clean, it&#8217;s simple, it&#8217;s intuitive, and it&#8217;s fully backwards compatible. And yes, if you have a variable named &#8220;local&#8221; it&#8217;ll still work, the variable will just become LOCAL.local, and as the LOCAL scope is in the default evaluation chain it&#8217;ll just work.&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

