1 Reply Latest reply on Mar 30, 2010 5:33 AM by BryonSR

    Problematic Null Handling in CF9 Serialization

    BryonSR

      When upgrading a dev environment from CF8 to CF9, I noticed a disruptive change in how nulls are handled in the serialization process.

       

      Example objects:

       

      [RemoteClass(alias="SomeVO")]

      public class SomeVO {

         public var whatever:Array = null;

       

        public function SomeVO() { }

      }

       

      <cfcomponent name="SomeVO" alias="SomeVO">

         <cfproperty name="whatever" type="array"/>

       

        <cfset  this.whatever = arrayNew(1)/>

      </cfcomponent>

       

      Using CF8, when SomeVO is passed from the Flex application to the server, once the serializer is done, SomeVO.whatever is an empty array, indicating the serialization process saw null and (AFAIK) just ignored it. Doing the same in CF9, someVO.whatever is an empty string.

       

      This is a problem, as there is a reasonable expectation that the properties of the object in hand remain consistent throughout the process.

       

      If I try to do anything with SomeVO.whatever, like measure the length of the array or pass it back to Flex, an error will be thrown because the serializer has turned the array into a string.

       

      I'm not saying whether this paradigm change is right or wrong, but am wondering what Adobe's stance is on addressing it. If no action, that implies adding to our transfer objects defensive setters, or some other modification that will impact a lot of code that is stable in CF8.