Cfparam default and null value

Hi!

I want to migrate an Adobe Coldfusion app to Lucee and I’m testing the version 5.3.8.139-RC. With the Null Support - Partial Support (CFML Default) setting, my queries return an empty string for the column with a null value. That’s fine. For some reasons I want to use the Null Support - Complete Support, but my queries return null for the column with a null value. My code look like this :

<cfparam name="FORM.myField" default="#myQuery.myNullColumn#" type="string">

It throw this error : The required parameter [FORM.myField] was not provided.

I noticed we can do this:

<cfset FORM.myField = nullValue()>

But not this :

<cfparam name="FORM.myField" default="#NullValue()#">

Is it a normal behavior? If I want to use the Null Support - Complete Support, do I need to rewrite all my code that can return a null value and set a form field with the default attribute?

Is it possible to configure Lucee so that SQL queries return empty fields rather than null like before, but still have full support for null?

Thank you!

This is because Lucee treats empty strings as null

There’s a similar problem with writelog if the text is empty

https://luceeserver.atlassian.net/browse/LDEV-174

Thank you @Zackster.

In your opinion, should Lucee allow the following code when Null Support - Complete Support is enabled?

<cfparam name="FORM.myField" default="#NullValue()#" type="string">

Should I submit a bug report, a feature/enhancement request or see it as a normal behavior and change all my code?

yes please do a bug report for this, there will come some improvements with null handling in Lucee 6 (with complete support enabled), for example this will be supported

Whatever function getWhatever(id) {
   if(id==0) return null;
}
w=getWhatever(0);
if(w==null) throw "Whatever!!!";

In Lucee you get an error “null cannot be Whatever”

I submitted the bug report : [LDEV-3246] - Lucee

3 posts were split to a new topic: How pass send empty strings to the database?