Bug #67179 [Opn->Csd]: On invalid datetime, $this not set in overloaded DateTime::__construct
| From: | remi@php.net | Date: | Sat, 07 Jun 2014 09:03:58 +0000 |
| Subject: | Bug #67179 [Opn->Csd]: On invalid datetime, $this not set in overloaded DateTime::__construct | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186091@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67179&edit=1
ID: 67179
Updated by: remi@php.net
Reported by: arjen at react dot com
Summary: On invalid datetime, $this not set in overloaded
DateTime::__construct
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.6.0beta2
-Assigned To:
+Assigned To: remi
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2014-06-06 08:13:54] arjen at react dot com
Fixed in https://bugs.php.net/bug.php?id=67118
http://git.php.net/?p=php-src.git;a=commit;h=1fe9f1e4f572d7b4d5a3872f41ea61e71fb563bf
http://git.php.net/?p=php-src.git;a=commit;h=15d8c80ead75be976c18a66b0933cf52f3e6579f
------------------------------------------------------------------------
[2014-05-02 09:46:13] arjen at react dot com
Description:
------------
See http://3v4l.org/aWPaq
Probably broken while fixing 66721 or 67118
I think the 5.3.0-5.3.5 behaviour is correct: $this exists but has no properties set.
Test script:
---------------
<?php
set_error_handler(function($errno, $errstr){ throw new Exception($errstr);});
class DateTimeCustom extends DateTime
{
public function __construct($datetime, $timezone = null)
{
try
{
parent::__construct($datetime, $timezone);
}
catch (Exception $e)
{
var_dump($this);
}
}
}
$date = new DateTimeCustom('sunday 09 september 2001 103:46:40 CEST');
Expected result:
----------------
object(DateTimeCustom)#2 (0) {
}
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67179&edit=1