Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Sanjeev Krishna / Sanjeev Krishna (Sanjeev MANDALAPU)
Created: 08/01/2013
Components: Language
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final / CF10_Update14
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 7
Vote Count: 0
**** Problem Description: ****
--------------------------------------------
Returning an implict struct in a <cfcatch> in tag modes throws an undefined element error
**** Steps to Reproduce: ****
--------------------------------------------
[___ CFC File ___]
<cfcomponent output="false">
<cffunction name="blahExplicit" returntype="Struct">
<cfset var name = 'ColdFusion'/>
<cfset var ret = structNew()/>
<cftry>
<cfreturn {success: true, data: name}/>
<cfcatch type="any">
<cfset ret.success = false />
<cfset ret.data = cfcatch />
<cfreturn ret/>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="blahImplicit" returntype="Struct">
<cfset var name = 'ColdFusion'/>
<cftry>
<cfreturn {success: true, data: name}/>
<cfcatch type="any">
<cfreturn {success: false, data: cfcatch.detail}/>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="script_blahExplicit" returntype="Struct">
<cfscript>
var name = 'ColdFusion';
var ret = structNew();
try{
return {success: true, data: name};
} catch(Any err){
ret.success = false;
ret.data = err.detail;
return ret;
}
</cfscript>
</cffunction>
<cffunction name="script_blahImplicit" returntype="Struct">
<cfscript>
var name = 'ColdFusion';
try{
return {success: true, data: name};
} catch(Any err){
return {success: false, data: err.detail};
}
</cfscript>
</cffunction>
</cfcomponent>
[___ CFM File ___]
<cfset cObj = createObject("component","componentFile")/>
<cfdump var="#cObj.blahExplicit()#" label="blah Explicit"/>
<cfdump var="#cObj.script_blahExplicit()#" label="blah Explicit With Script"/>
<cfdump var="#cObj.script_blahImplicit()#" label="blah Implicit With Script"/>
<cfdump var="#cObj.blahImplicit()#" label="blah Implicit"/>
**** Actual Result: ****
---------------------------------
blahExplicit(). script_blahExplicit. script_blahImplicit() methods work as expected. But blahImplicit() throws an "Element DETAIL is undefined in CFCATCH" error.
**** Expected Result: ****
-------------------------------------
All 4 methods
1. blahExplicit().
2. script_blahExplicit()
3. script_blahImplicit(),
4. blahImplicit()
should work properly returning an struct with success and data values.
**** Any Workarounds: ****
----------------------------------------
The code only fails in the case of returning implicit struct in <cfcatch> in a tag mode only. Using cfscript or declaring an explicit struct seems to be a work around.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3605332
External Customer Info:
External Company:
External Customer Name: Sanjeev MANDALAPU
External Customer Email:
External Test Config: ColdFusion 10u10, CF9 32bit, Apache as web server and running on a Win7 i5.
Attachments:
- August 01, 2013 00:00:00: 1_cfcatchBug.zip
Comments: