April 25, 2022
Turning on NULL support in ColdFusion 2018+
Comments
(1)
April 25, 2022
Turning on NULL support in ColdFusion 2018+
ColdFusion developer for 20+ years, professional experience in 10 other languages & frameworks. Artist, nerd, Jeep enthusiast.
Newbie 35 posts
Followers: 26 people
(1)

While playing around with booleans, I ended up running into some fun stuff(tm) having to do with NULL. As you might be aware, as of Adobe ColdFusion 2018, the framework has supported NULL values, but what you might not be aware of is that you can turn them on and off either globally (via the Administrator) or on a per-application level.

Now, why is the latter important? Simply put, if you have a large number of older applications running, but want to support NULL in your newer apps, it can have devestating effects on your older code to simply turn on NULL support globally. At best, you’d need to do a large amount of regression testing, something that may not be in the cards for very large code-sets.

To turn on NULL support globally, you would of course go into your ColdFusion administrator, and on the first page of the first tab, scroll down to Enable NULL Support, and make sure the box is checked, then click save. No server restart in required in this case, it would immediately begin to accept NULL values.

However, if you were looking to simply enable NULL support in a new app, or perhaps try out NULL support in one existing application without affecting the others, you would want to go into the application.cfc of that application (you do separate your applications out and name them, right?) and type:

this.enableNullSupport = true;

Keep in mind, the way that several functions operate changes when NULL support is turned on in this way. In particular, the isNull() now returns true for a variable which is null. With NULL support turned off, isNull() instead functions as the opposite of isDefined(), returning true if a variable is not defined (essentially a shortcut of NOT isDefined()).

1 Comment
2024-03-01 13:36:05
2024-03-01 13:36:05

Attachment

I enabled Null Support in administrator.  But it isn’t working.

Still getting the error.

 

 

 

Like
Add Comment