note 81228 added to function.date-create
| From: | prikkeldraad at gmail dot com | Date: | Tue, 19 Feb 2008 13:56:26 +0000 |
| Subject: | note 81228 added to function.date-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136275@lists.php.net to get a copy of this message | ||
Serialization and unserialization fail for the DateTime object (PHP 5.2.5).
With your own __sleep and __wakeup function in a child class you can work around this problem.
<?php
class MyDateTime extends DateTime {
private $_str;
public function __sleep(){
$this->_str = $this->format('c');
return array('_str');
}
public function __wakeup() {
$this->__construct($this->_str);
}
}
?>
Regards, Mick
----
Server IP: 89.248.170.58
Probable Submitter: 82.92.211.218
----
Manual Page -- http://www.php.net/manual/en/function.date-create.php
Edit -- https://master.php.net/note/edit/81228
Del: integrated -- https://master.php.net/note/delete/81228/integrated
Del: useless -- https://master.php.net/note/delete/81228/useless
Del: bad code -- https://master.php.net/note/delete/81228/bad+code
Del: spam -- https://master.php.net/note/delete/81228/spam
Del: non-english -- https://master.php.net/note/delete/81228/non-english
Del: in docs -- https://master.php.net/note/delete/81228/in+docs
Del: other reasons-- https://master.php.net/note/delete/81228
Reject -- https://master.php.net/note/reject/81228
Search -- https://master.php.net/manage/user-notes.php