Skip to main content
WolfShade
Legend
February 14, 2019
Question

Variable undefined after latest patch for CF11

  • February 14, 2019
  • 9 replies
  • 6194 views

Hello, all,

We recently applied the most recent patch for CF11, and now we are being flooded with alert emails that a variable named "qRead" is undefined.

This is happening in a CFC function that gets distinct years from a database for news articles.

     <cffunction name=icleYears" output="false" access="public" returntype="Query" >
     <cfset qRead = "" />
          <cfquery name="qRead" datasource="news_2016" cachedwithin="#CreateTimeSpan(0,0,10,0)#">
               SELECT
                    DISTINCT TO_CHAR(TDATE,'YYYY') articleYears
               FROM
                    pa_news
               ORDER BY articleYears DESC
          </cfquery>
          <cfreturn qRead>
     </cffunction>

Whenever this function is accessed, a vague error message appears to the user, and an email is generated basically stating that "qRead is undefined".

We just rolled back the patch, and everything works fine.  Has anyone else experienced something like this?

V/r,

^ _ ^

    This topic has been closed for replies.

    9 replies

    Known Participant
    March 21, 2019

    Howdy!

    After installing the hotfix for CF-4204066, the missing variable problems related to cfquery and cachedWithin seem to be gone. I am no longer seeing those error messages and the queries appear to be functioning as they should.

    Before installing the hotfix I reverted my development system to the way it was just after CF11 u18 (in other words I undid all of the fun little tweaks I had done to make things work). This meant my other problems returned (neither cfhtmltopdf nor cffeed would run without errors), but, as mentioned, caching queries in a sandboxed environment seems to once again be working for me.

    Known Participant
    March 20, 2019

    I just requested a copy of the fix from Adobe. Will post back how it works out.

    Charlie Arehart
    Community Expert
    Community Expert
    March 20, 2019

    Wolf or others, can you confirm if the fix shared by Adobe, as discussed in this comment elsewhere, helps:

    Re: Cache, ColdFusion (11,0,18,314030)

    /Charlie (troubleshooter, carehart. org)
    WolfShade
    WolfShadeAuthor
    Legend
    March 20, 2019

    I haven't seen/heard about u19.  Is it out?

    V/r,

    ^ _ ^

    Charlie Arehart
    Community Expert
    Community Expert
    March 20, 2019

    No, and if you're asking relative to my last comment, it's a hot fix to be used until it's rolled into an update--which from experience prior to Feb could be some months away.

    /Charlie (troubleshooter, carehart. org)
    Known Participant
    March 6, 2019

    Just wanted to add an update. As a result of having to poke at a different problem, I decided to try something.

    I relocated the mysql-connector-java-5.1.46-bin.jar file from {cf.root}/cfusion/lib/ to {cf.root}/cfusion/wwwroot/WEB-INF/lib

    I added a ColdFusion sandbox entry (to the Files/Dirs area for the website's sandbox) allowing for the reading of the mysql-connector-java-5.1.46-bin.jar file.

    The undefined variable error message I was getting seems to have stopped. (and fingers crossed it is actually gone and ColdFusion isn't just messing with me)

    Personally I am beginning to wonder if somewhere between update 15 and 18 access to {cf.root}/cfusion/lib/ was modified causing ColdFusion sandbox issues as a result of permission failures. Because the first attempt at access fails, all subsequent calls also fail, but differently. But what do I know, I am a bear of little brain.

    Known Participant
    March 5, 2019

    Howdy!

    Just wondering, have there been any updates on this? I appear to be having either the same or a rather similar issue.

    When running a query like:

    <cffunction name="myQuery" returntype="query" output="false" access="public">

       <cfset var myQueryResult = "">

       <cfquery name="myQueryResult" cachedwithin="#CreateTimeSpan(1, 0, 0, 0)#" cacheID="myQueryCache">

          [SQL here]

       </cfquery>

       <cfreturn myQueryResult>

    </cffunction>

    I get the following error message: Variable MYQUERYRESULT is undefined.

    However, If I remove cachedwithin from the query there are no errors and the function (and its query) seem work as they should. I am starting to suspect this is either a cachedwithin issue or a Sandbox issue. Hence my curiosity about any new info.

    Running ColdFusion 11 Enterprise. Update 18 was installed Mar-4-2019, prior to that it was update 15 (on Win Server 2012). Sandbox Security is enabled.

    No errors during install of update 18, at least according to the install log.

    Using Java Jdk 1.8.0_201.

    Database is MySQL 5.7.25, using mysql-connector-java-5.1.46-bin.jar Data source connection verifies with status of OK in ColdFusion Administrator.

    WolfShade
    WolfShadeAuthor
    Legend
    March 5, 2019

    Hi, gigiw123,

    Nothing new.  In fact, if you check out my most recent thread here, we have applied u18 and are getting more of the same.

    CFDUMPing the VARIABLES scope shows only two items, CFERROR and ERROR, both of which parrot the message in the error email that the variable is undefined.

    V/r,

    ^ _ ^

    Adobe Employee
    February 17, 2019

    Hi Wolfshade,

    Please share the complete exception stacktrace so that we can investigate it further.

    You can send it to nimsharm@adobe.com

    -Nimit

    WolfShade
    WolfShadeAuthor
    Legend
    February 19, 2019

    I've been contacted directly by Vamseekrishna Nanneboina and Suchika Singh  about this issue.  I'll be sure to include you when I get the email ready that contains the pertinent information.  Not sure if I can get you the complete stack trace, but I'll get whatever I can to you all.

    V/r,

    ^ _ ^

    Inspiring
    February 15, 2019

    Hi,

    I've been naming my queries local.qRead etc. for years. Never use a variable without scope.

    BKBK
    Community Expert
    Community Expert
    February 14, 2019

    Odd.

    In any case, you would avoid some complications if you initialized with

    <cfset var qRead = "" />

    Or, perhaps even better, with

    <cfset var qRead = queryNew("") />

    given that the return type is query

    WolfShade
    WolfShadeAuthor
    Legend
    February 14, 2019

    I've had issues in the past when using var outside of a function.  Apparently, CF doesn't like to use var outside of a function.

    But I'll suggest the queryNew("") and see if that fixes it.  Thanks.

    V/r,

    ^ _ ^

    BKBK
    Community Expert
    Community Expert
    February 15, 2019

    WolfShade  wrote

    I've had issues in the past when using var outside of a function.  Apparently, CF doesn't like to use var outside of a function.

    I don't understand. We're in a function, aren't we?

    Without the var, qRead becomes effectively an instance variable of the component. It is then cached and, after 10 minutes, deleted from memory, and so on. All of this happening while the component's instance is still alive? These are some of the complications I was referring to.

    Carl Von Stetten
    Legend
    February 14, 2019

    A bunch of people have reported issues with queryExecute() following the updates, but I haven't heard of <cfquery> issues yet.