diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a9001bf341fc0fce34657831beda32e923452aa4..b1b28d777cdca6e5376a9d1024e0486f9ddf6df1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,8 @@ Feeds 6.x 1.0 xxxxx xx, 2010-xx-xx ---------------------------------- +- #736684 Souvent22, Mixologic: FeedsDateTime & Batch DateTime causes core + dumps. - #750168 jtr: _parser_common_syndication_title does not strip html tags before constructing a title. - #648080 pvhee: FeedsNodeProcessor - static caching of mapping targets makes diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 49d04f2230627f40cff108e0bc3c2d5324310614..17227542bb3752994a5ed52bf14c269d514b100a 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -346,6 +346,28 @@ class FeedsDateTimeElement extends FeedsElement { class FeedsDateTime extends DateTime { public $granularity = array(); protected static $allgranularity = array('year', 'month', 'day', 'hour', 'minute', 'second', 'zone'); + private $_serialized_time; + private $_serialized_timezone; + + /** + * Helper function to prepare the object during serialization. + * + * We are extending a core class and core classes cannot be serialized. + * + * Ref: http://bugs.php.net/41334, http://bugs.php.net/39821 + */ + public function __sleep(){ + $this->_serialized_time = $this->format('c'); + $this->_serialized_timezone = $this->getTimezone()->getName(); + return array('_serialized_time', '_serialized_timezone'); + } + + /** + * Upon unserializing, we must re-build ourselves using local variables. + */ + public function __wakeup() { + $this->__construct($this->_serialized_time, new DateTimeZone($this->_serialized_timezone)); + } /** * Overridden constructor.