tracker issue : CF-3038827

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

Bug 77753:cfproperty now creates getters and setters no matter what

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Nathan Strutz / Nathan Strutz (Nathan Strutz)

Created: 06/06/2009

Components: ORM Support

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 233019 / 237713

Priority/Frequency: Normal / Unknown

Locale/System: English / Win All

Vote Count: 0

Problem:

cfproperty now creates getters and setters no matter what. That's different, but OK. I made a cfc with only this:
<cfcomponent><cfproperty name="name"></cfcomponent>

When I call the methods, I get strange results:

<cfdump var="#ob.getName()#"> UNEXPECTED - returns a struct, {var=""}
<cfdump var="#ob.setName("XYZ")#"> UNEXPECTED - returns a struct, {var=""}
<cfdump var="#ob.getName()#"> EXPECTED - returns "XYZ"

The first getter should probably return an empty string. Better if it returned the default for the type, so if the cfproperty type="numeric" it should return 0, if cfproperty type="struct", it should return an empty struct instead of a struct with the key "VAR" and an empty string as a value - this one, if not fixed, will hurt eventually.

The setter should probably either return void, return the value set, or the object, effectively, <cfreturn this />. I prefer returning the object.
Method:

plain.cfc:
<cfcomponent>
	<cfproperty name="Name" type="struct" />
</cfcomponent>

plainTest.cfm:
<cfdump var="#ob.getName()#">
<cfdump var="#ob.setName({a="abz"})#">
<cfdump var="#ob.getName()#">
Result:

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

Watson Bug ID:	3038827

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: Nathan Strutz
External Customer Email: 36EC2AB9446105B39920157F
External Test Config: 06/06/2009

Attachments:

Comments: