Highlighted

Variable undefined after latest patch for CF11

LEGEND ,
Feb 14, 2019

Copy link to clipboard

Copied

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,

^ _ ^

Views

2.6K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Variable undefined after latest patch for CF11

LEGEND ,
Feb 14, 2019

Copy link to clipboard

Copied

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,

^ _ ^

Views

2.6K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Feb 14, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 14, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 14, 2019

Copy link to clipboard

Copied

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,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 14, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 15, 2019

Copy link to clipboard

Copied

BKBK  wrote

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

Now that you mention it, yes.  I was thinking of outside of

<cfscript>

    function myFunction(){

          ...

    }

</cfscript>

Bardnet​ normally I scope all of my variables when reading them, but if I'm setting to the variables scope I don't use "variables.varName" because the variables scope is default.  But I will also give your "local.qRead" suggestion a shot.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 15, 2019

Copy link to clipboard

Copied

I finally got a chance to test, and it didn't work.  Same error message.  "Message              Variable QREAD is undefined."

    <cffunction name="getYears" output="false" access="public" returntype="Query" >
        <cfset var qRead = queryNew("") /><!--- Clearly established "qRead" --->
        <cfquery name="qRead" datasource="_news" cachedwithin="#CreateTimeSpan(0,0,10,0)#">
            SELECT
                DISTINCT TO_CHAR(TDATE,'YYYY') articleYears
            FROM
                news
            ORDER BY articleYears DESC
        </cfquery>
        <cfreturn qRead><!--- This is the line indicated by error message as the problem.  --->
    </cffunction>

Not sure where to go with this, now.

Preran​, do you know if Adobe is addressing this critical issue?

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Employee ,
Feb 15, 2019

Copy link to clipboard

Copied

Hi Jack,

I am checking with the team. Will get back as soon as I hear from them.

Thanks,

Preran

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Enthusiast ,
Feb 15, 2019

Copy link to clipboard

Copied

Just curious incase it makes a difference, what DB type are you using?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 15, 2019

Copy link to clipboard

Copied

Oracle.  But it's not the DB, because it works just fine when we roll the update back.

And working for USG DoD, that's not an option.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 15, 2019

Copy link to clipboard

Copied

Thanks, Preran.

I hope Adobe can fix this, soon.  But, it's late on a Friday of a holiday weekend and I won't be back until Tuesday to find out.

Have a good weekend, all.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 16, 2019

Copy link to clipboard

Copied

WolfShade  wrote

I finally got a chance to test, and it didn't work.  Same error message.  "Message              Variable QREAD is undefined."

    <cffunction name="getYears" output="false" access="public" returntype="Query" >         <cfset var qRead = queryNew("") /><!--- Clearly established "qRead" --->         <cfquery name="qRead" datasource="_news" cachedwithin="#CreateTimeSpan(0,0,10,0)#">             SELECT                 DISTINCT TO_CHAR(TDATE,'YYYY') articleYears             FROM                 news             ORDER BY articleYears DESC         </cfquery>         <cfreturn qRead><!--- This is the line indicated by error message as the problem.  --->     </cffunction>

Not sure where to go with this, now.

Looks like a bug. Since we've got nothing to lose now, what about trying out a change of name - because of the caching - and pinning things down with some validation? Something like

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

        <cfquery name="qReadX" datasource="_news" cachedwithin="#CreateTimeSpan(0,0,10,0)#" result="qRes">

            SELECT

                DISTINCT TO_CHAR(TDATE,'YYYY') articleYears

            FROM

                news

            ORDER BY articleYears DESC

        </cfquery>

<cfif not isNull(qReadX)>

        <cfreturn qReadX>

<cfelse>

       <cfdump var="#qRes#">

</cfif>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 19, 2019

Copy link to clipboard

Copied

I have a meeting that is about to convene in a few minutes.  I'm going to trigger another error and forward a redacted email to Adobe for them to review.  Once I'm done with that, I'll give your suggestion a shot.  Thank you.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Feb 15, 2019

Copy link to clipboard

Copied

Hi,

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Employee ,
Feb 17, 2019

Copy link to clipboard

Copied

Hi Wolfshade,

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

You can send it to nimsharm@adobe.com

-Nimit

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Feb 19, 2019

Copy link to clipboard

Copied

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,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Explorer ,
Mar 05, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
LEGEND ,
Mar 05, 2019

Copy link to clipboard

Copied

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,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...