php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71635 DatePeriod::getEndDate segfault
Submitted: 2016-02-19 21:00 UTC Modified: 2016-03-11 13:28 UTC
From: tim_siebels_aurich at yahoo dot de Assigned: ab (profile)
Status: Closed Package: Date/time related
PHP Version: 5.6.18 OS: Linux
Private report: No CVE-ID: None
 [2016-02-19 21:00 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-20 22:58 UTC] tpunt@php.net
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
 [2016-02-21 18:13 UTC] ab@php.net
Thanks for the report and patch. @tpunt, since it's reported against 5.6, could you please create a PR with your prospective patch targeting 5.6 and ping Derick for a review?

Thanks.
 [2016-03-11 13:28 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-03-11 13:28 UTC] ab@php.net
Patch applied to 5.6+.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC