I noticed that when I call the function of the previously included (cfinclude) .cfm file, all the cold words (cfimport) imported into it are forgotten. As if you didn’t import anything. I found this very strange behavior, so I isolated it, but the results remained the same, even in coldfusion 10.
My setup:
/Example
- functions.cfm
- index.cfm
- /Components
functions.cfm:
<cfscript> function test(){ return "test"; } </cfscript>
code>
components / MyCFC.cfc:
component output="false"{}
index.cfm:
<cfscript> include "functions.cfm"; import components.MyCFC;
foo = test(); bar = new MyCFC(); </cfscript>
code>
This code will throw a coldfusion error: "Could not find ColdFusion component or MyCFC interface." when foo = test(); deleted or placed after bar = new MyCFC(); The code works very well.
It does not matter if the import is placed before or after inclusion. Whenever a function is enabled, the import is forgotten.
Is this a mistake or should it behave this way?
Tested with cold administration of 9,0,0,251028 and coldfusion 10,282462
source share