isNull() not working corrently with null SQL values

Description

I have Complete Support for Null turned on...
I noticed some weird results when I got null values from the db, and wrote this simple test page:

Similar to the sample code in the Lucee docs: https://docs.lucee.org/guides/cookbooks/NullSupport.html

The output says myQuery._null is Empty:null, as expected.
but isNull(myQuery._null) is false

It's possible that this is an old bug, since apparently my version of Lucee is out of date, but I don't currently have the ability to upgrade it myself to test. We're converting a large project from an old version of BlueDragon and this is the version of Lucee we are developing on for the time being. I just figured I'd pass this along in case it's still a problem, and I'd appreciate it if somebody could let me know whether or not it's been fixed in later versions.

Thanks!
-Partap

Environment

Lucee 5.3.1.102

Windows Server 2019
MS SQL Server 2017

Activity

Show:
Pothys - MitrahSoft
August 5, 2019, 1:20 PM

I've checked this ticket in ACF and lucee ( latest version 5.3.4.22 ) both are returns the same result.

  • If give input like isNull(null) both of them returns true.

  • And also executes the cfquery which gets data from DB also returns a true for only null values.

  • If created a query using queryNew function with null values & tested with what you described above in the ticket - both lucee & ACF returns a false value.

will decide about this issue.

Partap Davis
August 7, 2019, 10:45 PM
Edited

It looks like in the second point you are saying isnull() returns true for null values created with <cfquery>, but int the third point you say that isnull() returns false for null values created with queryNew()… and that this is the case with both Lucee and ACF.

In other words, null values created by queryNew() are different from null values created by <cfquery>?

I may have misunderstood, but I added a little test to check on my Lucee installation:

 

And in my case, I got the same results as with the initial <cfquery> test:

myquery2._null is Empty:null and

isNull(myquery2._null) is false

Regardless, it seems you are saying that both Lucee and ACF return the same values when tested against null values returned in queries. So I guess Lucee duplicates a bug in ACF?

I’m still calling it a bug because it differs from the behavior described in the Lucee documentation…although the Lucee docs seem to imply that ACF would treat a query null value as an empty string… same as Lucee with “partial” null support…

Meanwhile, I seem to have found a workaround:

myquery2._null EQ null evaluates to true, even when isNull(myquery2._null) is false.

So there’s that…

Michael Offner
September 6, 2019, 1:57 PM

i can reproduce the issue with a query coming from a datasource or “queryNew”.

i assume that the problem is that in that case Lucee sees a column object and not the value itself.

Michael Offner
September 6, 2019, 2:10 PM

Fixed

Assignee

Michael Offner

Reporter

Partap Davis

Priority

New

Labels

Fix versions

Sprint

None

Affects versions

Configure