Changes between Version 1 and Version 2 of FAQs/WhyAreControllerVariablesBeingIncorrectlySharedAcrossUserRequests
- Timestamp:
- 06/22/11 14:48:58 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FAQs/WhyAreControllerVariablesBeingIncorrectlySharedAcrossUserRequests
v1 v2 22 22 }}} 23 23 24 25 24 This generally applies to all variables created in all CFCs for best practice. You do not need to use the "var" keyword inside .cfm pages or in Model Glue views, as there is no scope boundaries to accidentally cross. 26 25 Remember, using the "var" keyword on a variable inside a function body ensures that the variable only exists for that execution of the function. The variable is discarded after the function execution completes. 27 26 28 27 If you need help finding areas in your code that need the "var" keyword added, download the [http://varscoper.riaforge.org/ Varscoper tool]. The Varscoper tool will scan all of your code and report back the lines that need the "var" keyword added. 28 29 == A Note on !ColdFusion 9 ([http://www.coldfusionjedi.com/index.cfm/2010/2/8/Repeat--ColdFusion-9-does-NOT-remove-the-need-to-var-scope text borrowed from Ray Camden's site]) == 30 You must still continue to var scope your variables in UDFs and CFC methods. There is no change in this respect. !ColdFusion 9 only makes two related changes: 31 * The var scope previous was an "unnamed" scope. ColdFusion 9 fixes this by creating a scope called 'local'. Like other !ColdFusion scopes you can treat this as a structure. 32 * Because there is an implicit local scope, you can now skip the var keyword and use "local." instead: 33 * CF8 and older: var myVar1=1 34 * CF9: local.myVar1=1 35
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)