Title:
cfparam (and script param) improperly evaluates the default on each request
| View in TrackerStatus/Resolution/Reason: Closed/Deferred/HighRisk
Reporter/Name(from Bugbase): Steve Blades / Steve Blades (Steve Blades)
Created: 11/08/2013
Components: Language
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Platforms All
Vote Count: 1
Problem Description: When one used cfparam (or the scripted equivalent), the default value is evaluated on each instance, even if the variable already exists. This adds additional (and unnecessary) overhead to processing. For simple data types the effect is not extreme, but if you are trying to use a complex datatype, or an object instance, as the 'default', then it will slow down an application's overall performance.
Steps to Reproduce: http://www.bennadel.com/blog/2515-Default-CFParam-Expressions-Are-Always-Executed-In-ColdFusion.htm
Expected Result:
param name="REQUEST.foo" default=CreateObject("component", "com.cc.user");
// This param should be like this 'under the covers'
if (!StructKeyExists(REQUEST, "foo")
REQUEST.foo = CreateObject("component", "com.cc.user");
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3660491
Deployment Phase: Release Candidate
External Customer Info:
External Company:
External Customer Name: CutterBl
External Customer Email:
External Test Config: My Hardware and Environment details: Any
Attachments:
Comments: