Bug #67274 [Opn->Csd]: DateTime constructor crash with invalid data
| From: | kalle@php.net | Date: | Wed, 17 Dec 2014 17:51:34 +0000 |
| Subject: | Bug #67274 [Opn->Csd]: DateTime constructor crash with invalid data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189099@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67274&edit=1
ID: 67274
Updated by: kalle@php.net
Reported by: arjen at react dot com
Summary: DateTime constructor crash with invalid data
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: kalle
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2014-06-20 10:00:32] arjen at react dot com
Fixed in in 5.6.0rc1: http://3v4l.org/FeE0n#v560rc1
Commit in https://bugs.php.net/bug.php?id=67118
------------------------------------------------------------------------
[2014-05-14 09:23:32] arjen at react dot com
Description:
------------
Only partially solved in https://bugs.php.net/bug.php?id=67118
$this is unset (see https://bugs.php.net/bug.php?id=67179 for bug about
this) but corrupted internal state still intact. Catching exception and calling parent::format()
results in a segfault.
See http://3v4l.org/FeE0n#v536
Test script:
---------------
<?php
class DateTimeCustom extends DateTime
{
public function __construct($datetime, $timezone = null)
{
try
{
parent::__construct($datetime, $timezone);
}
catch (Exception $e)
{
var_dump($this, parent::getLastErrors(), parent::format('c'));
}
}
}
$date = new DateTimeCustom("sunday 09 blabla 2001 103:46:40 CEST");
Expected result:
----------------
Result for 5.3.0 - 5.3.5 is expected:
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its
constructor in /in/FeE0n on line 15
object(DateTimeCustom)#1 (0) {
}
bool(false)
bool(false)
Actual result:
--------------
Segfault.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67274&edit=1