Try scoping "bar" as "arguments.bar" and see what that does.

You're probably pushing your scope-hunting luck.

~Brad

-------- Original Message --------
Subject: cfdocumentitem resets arguments scope? nowai!
From: Yuliang Ruan <[email protected]>
Date: Thu, April 23, 2009 6:38 pm
To: cf-talk <[email protected]>


coworker struggled to find out why this code was breaking on him and
finally found out...but this perplexes even me

<cfcomponent>
<cffunction name="foo" access="remote">
 <cfargument name="bar" default="hi">
 
 <cfdocument format="PDF">
 <cfoutput>
 #bar# first
 </cfoutput>
 
 <cfdocumentitem type="footer">
 <cfoutput>#bar# second</cfoutput>
 </cfdocumentitem>
 </cfdocument>
</cffunction>
</cfcomponent>

the footer reference of #bar# gives this error. 

An exception occurred when performing document processing. 
The cause of this exception was that:
coldfusion.runtime.UndefinedVariableException: Variable BAR is
undefined.. 
The error occurred in yr/test.cfc: line 10
10 : <cfdocumentitem type="footer">
11 : <cfoutput>#bar# 2</cfoutput>
12 : </cfdocumentitem>


.....does that make sense to anyone? the first bar outside of the
cfdocumentitem runs just fine. it's only within the cfdocumentitem that
it seems to wipe the arguments scope. We found a workaround by setting a
local variable outside of the <cfdocument> to the value of the
argument....but it seems to me that shouldn't be necessary. 

We did dumps of the arguments scope both outside of the cfdocument and
inside. the outside dump shows correctly while the inside dump shows a
struct with a member "ATTRIBUTES", that has another struct inside it,
that's empty. MOST peculiar.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321919
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to