ColdFusion 2016: cfoutput with attributecollection causes "cannot find encodefor key in structure" error

If you run a CFOUTPUT with attributecollection you will get an error cannot find encodefor key in structure error.

Fails:

<cfset result = queryNew("id,name","Integer,Varchar",[{id=1,name="One"},{id=2,name="Two"},{id=3,name="Three"}]) />
<cfset params={query:'result'} />
 
<!--- this works --->
<cfoutput query="#params.query#">
#id# - #name#
</cfoutput>
 
<!--- this don't work --->
<cfoutput attributecollection="#params#">
#id# - #name#
</cfoutput>

Workaround: set a dummy key encodefor to none

<cfset result = queryNew("id,name","Integer,Varchar",[{id=1,name="One"},{id=2,name="Two"},{id=3,name="Three"}]) />
<cfset params = {query:'result', encodefor:'none'}  /> 
 
<cfoutput attributecollection="#params#">
#id# - #name#
</cfoutput>

We are currently waiting for a hotfix from Adobe.

Rating
Average: 8 (4 votes)