Bug #67179 [Opn]: On invalid datetime, $this not set in overloaded DateTime::__construct
| From: | arjen at react dot com | Date: | Fri, 06 Jun 2014 08:13:56 +0000 |
| Subject: | Bug #67179 [Opn]: On invalid datetime, $this not set in overloaded DateTime::__construct | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186079@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
User updated by: arjen at react dot com
Reported by: arjen at react dot com
Summary: On invalid datetime, $this not set in overloaded
DateTime::__construct
Status: Open
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.6.0beta2
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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