Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:35:18+00:00 2026-06-11T20:35:18+00:00

I noticed that when I call a function of a previously included (cfinclude) .cfm

  • 0

I noticed that when I call a function of a previously included (cfinclude) .cfm file, all the coldfusion imports (cfimport) that have happened at this point are forgotten. It’s like you haven’t imported anything. I found this very strange behavior so I’ve isolated it, but the results stayed the same, even in coldfusion 10.

My setup:

/example

  • functions.cfm
  • index.cfm
  • /components
    • MyCFC.cfc

functions.cfm:

<cfscript>
  function test(){
    return "test";
  }
</cfscript>

components/MyCFC.cfc:

component  output="false"{}

index.cfm:

<cfscript>
  include "functions.cfm";
  import components.MyCFC;
foo = test(); bar = new MyCFC(); </cfscript>

This code will throw a coldfusion error : "Could not find the ColdFusion component or interface MyCFC".
when foo = test(); is removed or placed after bar = new MyCFC();, the code runs just fine.

It doesn't matter if the import is placed before or after the include. Whenever an included function is called, the imports are forgotten.

Is this this a bug or is it supposed to behave this way?

Tested in coldfusion 9,0,0,251028 and coldfusion 10,282462

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:35:19+00:00Added an answer on June 11, 2026 at 8:35 pm

    Since I do a lot of imports, I recently met some odd behavior and reported it do the CF9-bugbase:
    https://bugbase.adobe.com/index.cfm?event=bug&id=3288035

    ColdFusion resolves the imports only for the current file and whenever you call a different file, it’s like the “execution context” switches to that files with it’s imports. So in your case when you execute new ColdFusion looks in functions.cfm for the imports. When you then call a method of the current file, it switches back and finds the import.

    If I am right, your code should work, if you execute bar = new MyCFC(); directly after the import. Or you could define another method in the index.cfm and call it, before you create the class.

    To work around that bug you need to make sure, that the import is resolved (on first use in the objects lifecycle) before that “context switching” takes place. So call new MyCFC(); before the external method.

    @Adobe: Would be nice to fix this;)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have noticed that when I call lseek64 on my block device driver file
I have just noticed that my ViewController does not call init (See below) when
I noticed that when I call the the_post() or the_content() function from my wordpress
I have just noticed that my timer callback function stops firing when iPhone screen
I have noticed that regardless of a given script's execution time, every date() call
I noticed that when you call a superclass's methods, you need to do something
I noticed that if you call FindWindowEx or EnumChildWindows against a hWnd that belongs
In the beta i noticed that the framework throws an exception if I call
While following path for wait system call, noticed that before calling do_wait_thread we get
I am trying to call a function that SELECTS values from my Web SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.