Status/Resolution/Reason: Closed/Won't Fix/
Reporter/Name(from Bugbase): Sebastian Zartner / Sebastian Zartner (Sebastian Zartner)
Created: 09/13/2010
Versions: 9.0.1
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Minor / Most users will encounter
Locale/System: English / Platforms All
Vote Count: 0
Problem:
Add a "var" attribute to <cfparam>
Currently <cfparam> is covering the following case (ignoring the type check):
<cfparam name="variable" default="defaultValue">
<cfset variable = isDefined("variable") ? variable : defaultValue>
Being able to specify a "var" attribute would also allow to cover the case in which to set another variable:
<cfparam name="variable" default="defaultValue" var="anotherVariable">
<!--- The above would be the same as this --->
<cfset anotherVariable = isDefined("variable") ? variable : defaultValue>
The use case here is, you want to check for the existance of a variable, but not want to overwrite it with the default value, if it's not existing. An example would be to check for an XML attribute:
<cfparam name="XMLContent.some.elements.down.XMLAttributes.id" default="0" var="id">
This would either save the id from the XML or 0 into the variable "id", but the XML won't be changed.
Method:
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3042148
External Customer Info:
External Company:
External Customer Name: Sebastian Zartner
External Customer Email: 4E7365D64550DB12992015D5
External Test Config: 09/13/2010
Attachments:
Comments: