Skip to main content
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with: Peter Bell
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with: Peter Bell

Adding NULL To A Set Breaks WriteDump() In Adobe ColdFusion 2025

By
Published in — Comments (1)

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:

CFDump of a Set showing that the poisoned set shows up as undefined.

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.

Want to use code from this post? Check out the license.

Reader Comments

Post A Comment — I'd Love To Hear From You!

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
— Ben Nadel
Managed ColdFusion hosting services provided by:
xByte Cloud Logo