tracker issue : CF-4203365

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

The cfinclude attribute runonce not working inside components

| View in Tracker

Status/Resolution/Reason: To Fix//Investigate

Reporter/Name(from Bugbase): Thomas Rafferty / ()

Created: 10/08/2018

Components: CFComponent

Versions: 2016,11.0,13.0

Failure Type: Others

Found In Build/Fixed In Build: 11,0,12,302575 /

Priority/Frequency: Normal /

Locale/System: / Windows 10 64 bit

Vote Count: 0

Problem Description:
The error message "Routines cannot be declared more than once" is being shown for a function that is included twice with runonce="true" specified both times.

This problem does not occur using Lucee.

Steps to Reproduce:

Here is a short test case of 4 files that reproduces the problem.

<!--- /index.cfm --->
<cfset createObject("component", "component").init()>

<!--- /component.cfc --->
	<cffunction name="init" output="true">
		<cfinclude template="file_that_depends_on_message.cfm" runonce="true">
		<cfinclude template="message.cfm" runonce="true">
		<cfset message("component")>

<!--- /file_that_depends_on_message.cfm --->
<cfinclude template="message.cfm" runonce="true">
<cfset message("file that depends on message")>

<!--- /message.cfm --->
<cffunction name="message" output="true">
	<cfargument name="value" type="string">

Actual Result:
The error message "Routines cannot be declared more than once."

Expected Result:
"file that depends on message

Any Workarounds:
Using cfscript, the function can be defined anonymously and assigned to a variable.
	 variables.message = function(value) {