tracker issue : CF-3989302

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

cfouput around cftry causes Undefined Variable in UDF with struct as argument

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Brian Paulson / Brian Paulson (Brian Paulson)

Created: 05/17/2015

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: ALL / Windows 7 SP1 64-bit

Vote Count: 1

Problem Description:
When you have a cfouput around a cftry block and within that try block you have a function call that has a struct with variables inside it the variables in the struct will be undefined, and will not be caught in the try catch aroung the block, but as an unhandled error. 

Steps to Reproduce:

<cfoutput><cftry>
<cfset cdata ="Test">
#outputTest("test",{"cdata"=cdata})#
<cfcatch type="any">
    <cfdump var="#cfcatch#">
</cfcatch>
</cftry>
</cfoutput>
<cffunction name="outputTest" output="false">
    <cfargument name="id" type="string" default="">
    <cfargument name="options" type="struct">
    <!--- dont need to do anything in here --->
    <cfreturn id>
</cffunction>

Actual Result:

Undefined variable cdata 

Expected Result:

string returned from UDF to be output on the page.

Any Workarounds:

<cftry>
<cfoutput>
<cfset cdata ="Test">
#outputTest("test",{"cdata"=cdata})#
</cfoutput>
<cfcatch type="any">
    <cfdump var="#cfcatch#">
</cfcatch>
</cftry>
<cffunction name="outputTest" output="false">
    <cfargument name="id" type="string" default="">
    <cfargument name="options" type="struct">
    <!--- dont need to do anything in here --->
    <cfreturn id>
</cffunction>

Place cfoutput tags inside try catch

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

Watson Bug ID:	3989302

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



server: windows 7

Attachments:

Comments:

Please take five minutes to remove the 25 character requirement so folks can just vote for a bug. Please.
Vote by External U.
7428 | May 18, 2015 05:37:54 AM GMT
This happens because of implicit struct. If struct is defined outside, string return from UDF is output to the page. Not an issue.
Comment by Poonam J.
7427 | June 15, 2016 11:05:18 PM GMT