Bug #71635 [Com]: DatePeriod::getEndDate segfault
| From: | tpunt@php.net | Date: | Sat, 20 Feb 2016 22:58:37 +0000 |
| Subject: | Bug #71635 [Com]: DatePeriod::getEndDate segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199358@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71635&edit=1
ID: 71635
Comment by: tpunt@php.net
Reported by: tim_siebels_aurich at yahoo dot de
Summary: DatePeriod::getEndDate segfault
Status: Open
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.6.18
Block user comment: N
Private report: N
New Comment:
I have a fix for this, though not sure if it's foolproof:
https://github.com/php/php-src/compare/master...tpunt:fix-dateperiod-segfault
Previous Comments:
------------------------------------------------------------------------
[2016-02-19 21:00:58] tim_siebels_aurich at yahoo dot de
Description:
------------
When creating a DatePeriod object with no end date, but recurrances given, the runtime segfaults.
Test script:
---------------
<?php
// https://3v4l.org/a044v
$period = new DatePeriod(new DateTimeImmutable("now"), new
DateInterval("P2Y4DT6H8M"), 2);
var_dump($period->getStartDate());
var_dump($period->getEndDate());
Expected result:
----------------
object(DateTimeImmutable)#2 (3) {
["date"]=> string(26) "2016-02-19 21:45:08.000000"
["timezone_type"]=> int(3)
["timezone"]=> string(16) "Europe/Amsterdam"
}
object(DateTimeImmutable)#8 (1) {
["date"]=> string(26) "2016-02-19 21:59:23.000000"
["timezone_type"]=> int(3)
["timezone"]=> string(13) "Europe/Berlin"
}
Actual result:
--------------
object(DateTimeImmutable)#2 (3) {
["date"]=> string(26) "2016-02-19 21:45:08.000000"
["timezone_type"]=> int(3)
["timezone"]=> string(16) "Europe/Amsterdam"
}
Process exited with code 139.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71635&edit=1