Sorry, this is the best title I can come up with.
I am hoping someone on here can give me an explanation to this behavior. My employer just decided to upgrade CF 8 to CF 10 (yeah, I know). However, some of the servers are on CF 10 and some are on CF 8. I know it is not supposed to be like this; but this is not within my control. Anyway, I have the following codes. It breaks in CF 8 but works in CF 10 without errors. In CF 8, it is saying that element a is not defined in local, which is expected and I don't have a problem with that. After all, local is declared twice and a is not defined in the second one.
But in CF 10, no errors generated and local.a is returned by the function. To me, CF 10 should throw an error either because the same reason why CF 8 fails or because "local" is a reserved word in CF 10 ("local" was introduced in CF 9). Why is it that CF 10 does not throw any errors?
<cfcomponent name="myComponent">
<cffunction name="myFunction" returntype="Numeric">
<cfscript>
var local = StructNew();
local.a = 1;
</cfscript>
<cfset local = StructNew()>
<cfif local.a is 0>
<!--- do something --->
</cfif>
<cfreturn local.a>
</cffunction>
</cfcomponent>