tracker issue : CF-3133547

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

Bug introduced in ColdFusion 9 still plagues us today - session scope gets trashed

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Andrew Scott / Andrew Scott (Andrew Scott)

Created: 03/08/2012

Components: Language

Versions: 10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: Public Beta /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Windows 7

Vote Count: 1

Problem Description:

I reported this over 3 years ago, and I see that ColdFusion still suffers the same problem. I have ColdFusion 8 code that I would like to migrate to ColdFusion 9, however this was never fixed. So when I tried this on ColdFusion 10 I am shocked to see that the bug still exists.

I know many applications that may not upgrade / migrate to newer versions, because it would make it hard for them to justify modifying a lot of code at a customers expense.

Can we please have this fixed. I know you are going to defer this, but please this bug has been around long enough. I have customers that wish to migrate to ColdFusion 9 or maybe 10, but I can't justify changing so much of the application to not use scope names as variable names.

This is actually what I would consider a critical blocker for anyone who wishes to upgrade their servers to the latest ColdFusion 10, or even update to ColdFusion 9. And I would bet my bottom dollar that unless it is fixed, you may even loose people who will continue to develop in ColdFusion. I know that is a harsh statement to make, but think about how frustrated that code that works in previous versions is going to effect their decision to continue to develop with ColdFusion in the future.


Steps to Reproduce:

Write and Index.cfm page that has the following code.

<cfscript>
	
	session.andrew = 'Hello';
	myObj = new test().wtf();
	
</cfscript>

Write a component called test and place it in the root directory and put the following code into it.

component {
	public void function wtf() {
		var local.session = 'something';
		writeDump(session);
	}
}


Actual Result:
Dumps the local.session which is wrong.


Expected Result:
Should actually dump the session structure or scope.


Any Workarounds:.

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

Watson Bug ID:	3133547

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

Attachments:

Comments:

I should also add one more thing before this is marked as not a bug. When searching for variable names, ColdFusion should first check to see if it is an actual scope name first, if it is then it should not do a search through the search order. For example in my example writeDump(session) would dump the session as writeDump(local) wold dump the local scope. But writeDump(local.session) should dump the variable defined in the local scope.
Comment by External U.
20175 | March 08, 2012 10:49:39 AM GMT
I will also add that ColdFusion debugger in ColdFusion builder is a testament of this problem as well. For example, when stepping into the example code. The debugger also reports that there is no session as well, when debugging it is very important that something like this not confuse the developer any more than they are. The debugger is suppose to show a snapshot of all the given scopes, at any given time. When they see the session variable in the debugger go missing like this, it can be a hair pulling experience trying to work out why.
Comment by External U.
20176 | March 08, 2012 10:53:43 AM GMT
Please see this video for more information http://vimeo.com/19345476
Comment by External U.
20177 | March 09, 2012 05:03:31 AM GMT
As there was a huge discussion on this on Ray Camden's blog, and the fact that Railo does not suffer this problem. It looks like it is something that should be addressed, for more information and the discussion http://www.raymondcamden.com/index.cfm/2012/3/8/Avoid-ColdFusion-Scope-Names-as-Arguments#cAAB1F084-080F-5F18-751F7775FFD5C2FB
Comment by External U.
20178 | March 09, 2012 07:13:33 AM GMT
Too risky to be taken up for this release. Will be considered for the next
Comment by Rupesh K.
20179 | March 12, 2012 07:07:40 AM GMT
"session" if used without any prefix should always refer to the session scope since that is the reserved scope. we should fix it.
Comment by Rupesh K.
20180 | November 20, 2014 05:25:03 AM GMT
Adobe, The last comment says "we should fix it", yet the ticket's status is Open/ToTest/NeverFix. I'm confused.. what's the actual verdict? Thanks!, -Aaron
Comment by External U.
20181 | September 23, 2015 01:27:38 AM GMT
*sigh* Not only was it reported 3 years prior to this ticket, but this ticket is also 3 years old. It's no wonder developers are moving away from ColdFusion in droves, they can't be bothered keeping fixing these sort of bugs. not only that, but it will only get fixed in the current next release, not any other supported previous release which to be honest I have had enough off.
Comment by External U.
20182 | September 23, 2015 01:51:22 AM GMT
If we consider scope names always as reserved, cfloop over a query might break if the database column name is having any of the reserved scope names. From long we have been searching scopes in some fixed order and not treating the reserved scopes as special, will change the behavior in many places where reserved scope name is used as a variable. Thanks, Pavan.
Comment by S V.
20183 | September 25, 2015 07:32:22 AM GMT
As a developer, I don't care how it works under the hood as long as it works. The fact that you have this series issue under the hood screams bad coding. This is not the first time I have come across issues like this, where Adobe put it into the too hard basket because it means massive changes under the hood. But if someone wants to dump a scope, they should be able too. Not some variable in another scope. Because scopes can't be scoped, where as local.session can be scoped. The day Adobe actually get that, will be the day I fall over from shock.
Comment by External U.
20184 | September 27, 2015 09:48:01 PM GMT
On a side note, you should perhaps read the ColdFusion documentation when it comes to reserved words, because that means that documentation is BS if what you say is correct.
Comment by External U.
20185 | September 27, 2015 09:49:33 PM GMT
I don't think I made my point clear, so I will try to explain. When going from ColdFusion 8 to 9, we suddenly ran into an issue where we had local.session set up in all our code. Correctly scoped, so any future changes should not hinder that. When ColdFusion 9 came onto the scene, where we had correctly scoped our variable we found that the session was actually getting trashed. ColdFusion had basically said, even though we had local.session = 'test'; It would set session equal to the right hand side and therefore became 'test' and no longer an actual session. This bug is similar because we expect session to get dumped because we know this is a scope and not a variable, in the case where as you mention column name, in cases like that it becomes the responsibility of the developer to make sure the variable becomes correctly scoped. This is also one reason, that scoping should be an enforced checking, none of this go and search if we actually meant variable over a scope and just say variable not found.
Comment by External U.
20186 | September 27, 2015 10:13:23 PM GMT
+1 - Please fix. Scope shadowing is undesired. Lucee gets it right: https://docs.lucee.org/guides/developing-with-lucee-server/language-syntax-differences.html#scope-names-cannot-be-overwritten Suggestion: THIS.enableScopeShadowing=true(default):false
Vote by Aaron N.
29498 | August 15, 2018 11:20:37 PM GMT
Hi Pavan, Unscoped references to query columns in a cfloop is sloppy and shouldn't prevent the logical behavior requested in this ticket. It is disheartening to see Lucee adding many of the features we've been wanting: https://docs.lucee.org/guides/developing-with-lucee-server/language-syntax-differences.html Thanks!, -Aaron
Comment by Aaron N.
29526 | August 17, 2018 06:19:53 AM GMT
Hi Andrew, I've filed CF-4203281 for per-app setting THIS.enableScopeShadowing. THIS.enableScopeShadowing=false would match Lucee's behavior we're wanting; whereas THIS.enableScopeShadowing=true preserves backward-compat. Thanks!, -Aaron
Comment by Aaron N.
29527 | August 17, 2018 06:21:45 AM GMT
This is one of the reasons I no longer develop using ColdFusion, since Adobe took ownership of the product it has done nothing but go down hill. script bugs like this is the main reason I will never return to the product either.
Comment by Andrew S.
29539 | August 18, 2018 05:02:53 AM GMT