Menu

#7 Deserializing java.sql.Timestamp

open
nobody
None
5
2006-05-24
2006-05-24
Anonymous
No

There is a bug in the deserialzer.
When one sends a java.sql.Timestamp from the server to
the client (HessianPHP, maybe others as well) then the
deserializer does not recognize the Timestamp as date
type but as map.

No problem with this at first thought, but in a complex
object structure the reference map gets out of sync.
E.g. I have a customer object with a start date (start
of being customer for me) and some other 'object
attributes'. Now the reference map contains one extra
object extra (the Timestamp) and therefore the
continuing deserializsation fails...

There must be some way to have hte Timestamp in PHP
exteds the DateTime class so this is recognized as date
and is not written to the reference map since dates
does not belong to the reference map.

Discussion

  • Markus Wolf

    Markus Wolf - 2006-05-24

    Logged In: YES
    user_id=870001

    To patch this add the following lines to Protocol.php at
    line 388:

    if ($type != 'java.sql.Date'

    && $type != 'java.sql.Time'

    && $type != 'java.sql.Timestamp') {

    $this->refs[] = &$map;

    }

    This is consistent with the Java hessian implementation.
    Look at this at the SerializerFactory, SqlDateSerializer and
    SqlDateDeserializer.

     
  • Juliano Viana

    Juliano Viana - 2006-10-30

    Logged In: YES
    user_id=431526

    This is actually a Java hessian library bug - not hessian PHP.
    See http://bugs.caucho.com/view.php?id=1417

     

Log in to post a comment.

MongoDB Logo MongoDB