|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 Patchesdate_patch_var4.patch (last revision 2013-03-14 15:21 UTC by ab@php.net)date_patch_var3.patch (last revision 2013-03-13 08:53 UTC by ab@php.net) glopes_date_5.3.patch (last revision 2013-03-06 18:50 UTC by ab@php.net) glopes_date_5.4.patch (last revision 2013-03-05 11:20 UTC by ab@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits              [2010-12-01 17:24 UTC] cataphract@php.net
 
-Status: Open
+Status: Verified
  [2010-12-01 17:41 UTC] cataphract@php.net
 
-Status:      Verified
+Status:      Assigned
-Assigned To:
+Assigned To: cataphract
  [2010-12-01 21:50 UTC] felipe@php.net
  [2011-01-09 06:00 UTC] cataphract@php.net
 
-Assigned To: cataphract
+Assigned To: derick
  [2011-01-09 06:00 UTC] cataphract@php.net
  [2011-12-06 06:07 UTC] derick@php.net
  [2011-12-21 15:10 UTC] tony2001@php.net
  [2013-03-04 12:43 UTC] ab@php.net
  [2013-03-05 11:19 UTC] ab@php.net
  [2013-03-05 11:20 UTC] ab@php.net
  [2013-03-06 18:50 UTC] ab@php.net
  [2013-03-13 08:53 UTC] ab@php.net
  [2013-03-14 15:21 UTC] ab@php.net
  [2013-03-15 16:02 UTC] ab@php.net
  [2013-03-15 16:02 UTC] ab@php.net
 
-Status: Assigned
+Status: Closed
  [2013-11-17 09:31 UTC] laruence@php.net
  [2014-07-16 22:40 UTC] nate at frickenate dot com
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
Description: ------------ DatePeriod class does not have the serialization/unserialization logic implemented. Therefore, when unserialized instance is used, script crashes. This is result of serializing the DatePeriod instance: O:10:"DatePeriod":0:{} unserialize() wents fine as well, but when I call foreach() on unserialized instance, the script crashes. Test script: --------------- $dp = new DatePeriod(new DateTime('2010-01-01 UTC'), new DateInterval('P1D'), 2); echo "Original:\r\n"; foreach($dp as $dt) { echo $dt->format('Y-m-d H:i:s')."\r\n"; } echo "\r\n"; $ser = serialize($dp); // $ser is: O:10:"DatePeriod":0:{} // Create dangerous instance $dpu = unserialize($ser); // $dpu has invalid values… echo "Unserialized:\r\n"; // …which leads to CRASH: foreach($dpu as $dt) { echo $dt->format('Y-m-d H:i:s')."\r\n"; } Expected result: ---------------- Original: 2010-01-01 00:00:00 2010-01-02 00:00:00 2010-01-03 00:00:00 Unserialized: 2010-01-01 00:00:00 2010-01-02 00:00:00 2010-01-03 00:00:00 Actual result: -------------- PHP crashes on the "unserialize" line.