Hello,

I'd like to report a bug: thawing a freezed DateTime object with
floating timezone doesn't work. It can be reproduced by:

  my $dt = DateTime->now(time_zone => "floating");
  print Dumper( thaw(freeze($dt))->{tz} );

The timezone of the thawed object is an empty blessed hashref, without
name or offset. Note that this only happens with DateTime objects,
thawing a DateTime::TimeZone::Floating object directly works!

The problem is caused by STORABLE_attach. Removing it solves the problem
(without breaking any tests).

Then I found the following in DateTime::TimeZone's Changelog.
  0.54     2006-10-25
- Got rid of the STORABLE_attach methods. This was causing bugs when
  trying to freeze/thaw a DateTime.pm object, and I realized that
  because of how the DT::TimeZone internals work, there's not much
  gained by using STORABLE_attach instead of STORABLE_freeze. Even
  with STORABLE_freeze, the core data structures for a timezone are
  still shared.

Indeed the ::Floating package is the only one containing a
STORABLE_attach method, it looks like it was forgotten there.

Cheers,
Kostas


Reply via email to