|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67274 DateTime constructor crash with invalid data
Submitted: 2014-05-14 09:23 UTC Modified: 2014-12-17 17:51 UTC
From: arjen at react dot com Assigned: kalle (profile)
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 - 18 = ?
Subscribe to this entry?

 [2014-05-14 09:23 UTC] arjen at react dot com
Only partially solved in

$this is unset (see for bug about this) but corrupted internal state still intact. Catching exception and calling parent::format() results in a segfault.


Test script:

class DateTimeCustom extends DateTime
	public function __construct($datetime, $timezone = null)
        	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) {

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-20 10:00 UTC] arjen at react dot com
Fixed in in 5.6.0rc1:
Commit in
 [2014-12-17 17:51 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 01:01:31 2024 UTC