A few minutes ago, I posted that ColdFusion Sets don't work with circular references as of Adobe ColdFusion 2025 update 14. But when attempting to use sets within a data traversal algorithm, it's not the only issue that I ran into. If you add a null value to a Set, it poisons the Set and prevents ColdFusion from dumping it to the screen. You can still interact with the Set; you can even convert the Set to an array (which includes the null element); you just can't consume it within a writeDump() call.
<cfscript>
// In ColdFusion, a set can be generated from an array.
setOfValues = setNew([ "a", "b", "c", "d" ]);
// Adding a NULL value to the set POISONS it for dumping.
setOfValues.add( javaCast( "null", "" ) );
// Attempting to dump the poisoned Set directly will throw an error:
// --
// writeDump( setOfValues );
// > Element 5 is undefined in a Java object of type class coldfusion.runtime.Array.
// --
// However, if we dump the set indirectly, via a wrapper object, it just shows up in
// the output as a null / undefined property.
writeDump([
setOfValues: setOfValues,
// You can still interact with a poisoned set, you just can dump it.
hasA: setOfValues.has( "a" ),
hasZ: setOfValues.has( "z" ),
hasNull: setOfValues.has( javaCast( "null", "" ) ),
]);
</cfscript>
In this CFML code, note that I'm adding null as the 5th element in the Set. And when we run this code to render the Set via writeDump(), we get the following output:
As you can see, the three .has() calls work just fine. In fact, the Set is still fully functional and can even verify that null is contained within the Set. But, the Set itself cannot be rendered in the dump output.
Reader Comments
I filed a bug in the Adobe Tracker:
CF-4235669:
CFDump/WriteDumpcannot output Set that contains a NULL value.Post A Comment — ❤️ I'd Love To Hear From You! ❤️
Post a Comment →