Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Geoffrey Demoulin / Geoffrey Demoulin (Geoffrey Demoulin)
Created: 10/19/2015
Components: Language, CF Component
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 8.1/64bit
Vote Count: 4
Bug 3352745 has been marked as fixed but still happens when createObject() is called instead of the new() operator. Please see my comments as well as Aaron's on Bug 3352745.
Following description copied from Bug 3352745 with minor modifications:
Problem Description: When creating a component with accessors="true" and a property with a default value the variables struct does not contain the property in any method withing the component unless you set them explicitly in the init function.
Steps to Reproduce:
MyTest.cfc:
component accessors="true" {
property name="privateVarOne" default="privateVarOne default";
function init() {
return this;
}
public void function newMethod() {
var myVar = variables.privateVarOne;
writedump(var="success");
}
}
test.cfm:
<cfset test = createObject("Component", "MyTest").init() />
<cfset test.newMethod() />
Actual Result:
Element PRIVATEVARONE is undefined in VARIABLES.
Expected Result:
success
Any Workarounds:
With a dump in-between it suddenly magically works:
<cfset test = createObject("Component", "MyTest").init() />
<cfdump var="#test#" format="html">
<cfset test.newMethod() />
Explicit setting of variables.privateVarOne in the init function also works (without the dump)
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4076193
External Customer Info:
External Company:
External Customer Name: Geoffrey Demoulin
External Customer Email:
Attachments:
Comments: