tracker issue : CF-4137849

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

defaults not set in Variables if instantiated by CreateObject("component")

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)

Created: 04/08/2016

Components: CFComponent

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win All

Vote Count: 1

Duplicate ID:	CF-4076193

Problem Description:

with accessor=true, property default should be set and ready to go in Variables scope, but it is only true if the object is instantiated with the 'new' operator, and fails with CreateObject('component')

Steps to Reproduce:

// foo.cfc
component accessors="true" {
	property name="bar" default="1";
	
	function isBarDefined() {
		return structKeyExists(variables, 'bar');
	} 
} 

// testFoo.cfm
<cfscript>
	f1 = new Foo();
	writeoutput(f1.isBarDefined());
	
	f2 = createObject("component", 'Foo');
	writeoutput(f2.isBarDefined());</cfscript>

Actual Result:
YES NO

Expected Result:
YES YES

Any Workarounds:
manually call getter first, then the var will be set into variables scope.

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

Watson Bug ID:	4137849

External Customer Info:
External Company:  
External Customer Name: Henry Ho
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

This bug will affect anyone who uses Wirebox to manage their cfc's.
Comment by External U.
3128 | April 08, 2016 06:11:16 PM GMT
Duplicate of CF-4076193? (which, itself, is a continuation of CF-3352745) Thanks!, -Aaron
Comment by External U.
3129 | May 07, 2016 12:10:08 AM GMT
We will evaluate if this fix can be back-ported from 2016 to the other versions. Closing this a dupe of CF-4076193.
Comment by Vamseekrishna N.
3130 | August 03, 2016 03:16:53 AM GMT