Resurrecting a dead thread, but I thought it better than creating a new one. Shouldn't this behaviour be considered a bug in CF10.
- Deserialize a JSON structure that has null values
- If I perform the comparison IsNull(foo) it returns true as it should because that field is null. Now, IsNull is a type check.
- But, if I perform another type check such as IsDate(foo) I now get an error because ColdFusion is now saying that foo is undefined instead of null. This should be a bug. A type check is a type check, if the variable was null, its state shouldn't magically change to undefined when performing a different type check. And undefined does not equal null. Those are 2 different variable states.
If this is not a bug, then please explain why this should be failiing? And once again, this is for CF10.
<cfsetfoo = {string = "", mynull = ""}>
<cfsetfoo.mynull = javaCast("null", "")>
<cfsetbar = SerializeJSON(foo)>
<cfsetfoobar = DeSerializeJSON(bar) />
<cfdumpvar="#foobar#">
<cfoutput>
isNull = #isNull(foobar.mynull)#<br/>
<cftry>
isSimpleValue = #isSimpleValue(foobar.mynull)#<br/>
isDate = #isDate(foobar.mynull)#<br/>
isQuery = #isQuery(foobar.mynull)#<br/>
isArray = #isArray(foobar.mynull)#<br/>
isStruct = #isStruct(foobar.mynull)#<br/>
<cfcatchtype="Any">
<cfdumpvar="#cfcatch#">
</cfcatch>
</cftry>
</cfoutput>