tracker issue : CF-4031746

select a category, or use search below
(searches all categories and all time range)

Scope precedence in ColdFusion 10

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Himansu Sekhar Khuntia / Himansu Sekhar Khuntia (Himansu Sekhar Khuntia)

Created: 08/05/2015

Components: Language, General

Versions: 10.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: Final /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Windows 7 64-bit

Vote Count: 6

Listed in the version 2016.0.0.297996 Issues Fixed doc
Verification notes: verified_fixed on August 22, 2019 using build 2016.0.01.298513
Related Bugs:
CF-4119653 - Similar to

Problem Description: The scope precedence of unscoped variables is done in the following order as per ( But ARGUMENTS scope takes the precedence over the LOCAL scope.

Steps to Reproduce: 
<cffunction name = "foo">
    <cfargument name = "a" default = "In arguments">
    <cfset local.a = "In local scope">
    <cfdump var = "#a#"><br>

<cfset foo()>
<cfset foo("function Call")>

Actual Result: 
In arguments
function Call 

Expected Result:
In local scope
In local scope

Any Workarounds:
Use scope in all the variables used.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4031746

External Customer Info:
External Company:  
External Customer Name: Himansu
External Customer Email:  
External Test Config: My Hardware and Environment details:

ColdFusion 10

Version	10,0,15,292620

Tomcat Version

Edition	Developer  

Serial Number	Developer  

Operating System	Windows 7



Also confirmed in CF9 and CF11
Vote by External U.
6378 | August 05, 2015 06:28:24 AM GMT
I ran into this today, coincidentally right after we applied update 17. It's not caused by update 17, but I don't know how long it's been broke.
Vote by External U.
6379 | September 04, 2015 09:53:59 AM GMT
+1 Vote must be between 25 and 4000 charactersVote must be between 25 and 4000 charactersVote must be between 25 and 4000 characters
Vote by External U.
6380 | September 25, 2015 01:34:44 AM GMT
In which release with this be delivered?
Comment by External U.
6372 | September 26, 2015 04:32:10 AM GMT
+1 ......................
Vote by External U.
6381 | September 28, 2015 02:07:56 AM GMT
This is marked Fixed, but what was fixed? As of today, the behavior still exists in CF10 (v 10,0,17,295085 Developer), and I will confirm that Update 17 didn't change it. I can also confirm that if no Default value is set for the function argument, the LOCAL value is actually returned, per docs. Which is correct, the current behavior (ARGUMENTS precedence) or the documentation (LOCAL precedence)? Note: Different doc sources tend to report different order (ie shows ARGUMENTS takes precedence over LOCAL). So if this is a behavior bug rather than a doc bug, the other docs will need to be fixed.
Comment by External U.
6373 | November 12, 2015 12:36:48 PM GMT
My +1 is simply for an explanation of what the correct behavior _SHOULD_ be. And another +1 for this being a perfect example of why scoping is a necessity. :-/
Vote by External U.
6382 | November 12, 2015 12:39:10 PM GMT
Using CF10 - Update 18 - 10,0,18,296330 <<< Still says LOCAL should take precedence over ARGUMENTS. However, the ARGUMENTS scope is still evaluated first. The only time the LOCAL scope takes precedence is when the incoming argument is not sent and no default value is assigned. See my previous comment. Which is the proper behavior? Or which _SHOULD_ be the proper behavior?
Comment by External U.
6374 | February 01, 2016 03:31:32 PM GMT
+1 clarity on this is essential
Vote by External U.
6383 | February 01, 2016 09:28:39 PM GMT
Shawn, In a function, the local scope should have higher precedence. This is fixed in the just released CF 2016. We plan to take this up in subsequent CF10 and CF11 updates.
Comment by Piyush K.
6375 | February 23, 2016 02:25:54 PM GMT
@Piyush Is this related to, if so, I don't think it's fixed as those non-scoped variables now end up in the variables scope and not the local scope (or arguments scope, as would be my expectation).
Comment by External U.
6376 | February 24, 2016 06:19:31 AM GMT
@Piyush - Thanks for explaining the expected behavior.
Comment by External U.
6377 | February 24, 2016 08:36:49 AM GMT
Hi Adobe, I've verified this is fixed in CF2016 Update 1 (build 2016.0.01.298513). Thanks!, -Aaron
Comment by Aaron N.
31152 | August 22, 2019 10:23:19 AM GMT