Bug #67118 [Csd]: DateTime constructor crash with invalid data

From: Date: Mon, 25 Aug 2014 00:21:19 +0000
Subject: Bug #67118 [Csd]: DateTime constructor crash with invalid data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187265@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67118&edit=1 ID: 67118 Updated by: datibbaw@php.net Reported by: per at interapp dot se Summary: DateTime constructor crash with invalid data Status: Closed Type: Bug Package: Reproducible crash Operating System: Windows 2008 R2 PHP Version: 5.5.11 Assigned To: ab Block user comment: N Private report: N New Comment: This commit seems to have fixed the behaviour again: http://git.php.net/?p=php-src.git;a=commit;h=c749fe2067d29615df250e59c9a891a63dcc7e7f According to this code: class C extends DateTime { public function __construct($time = null, $timezone = null) { try { parent::__construct('XXXX'); return; } catch (Exception $e) {} if (is_null($this)) { print "THIS IS NULL\n"; } else { print "THIS STILL EXISTS\n"; } } } new C(); This now outputs: THIS STILL EXISTS Previous Comments: ------------------------------------------------------------------------ [2014-06-06 23:36:16] slusarz at curecanti dot org See: http://lists.horde.org/archives/dev/Week-of-Mon-20140602/028641.html In short: After these fixes http://git.php.net/?p=php-src.git;a=commit;h=1fe9f1e4f572d7b4d5a3872f41ea61e71fb563bf http://git.php.net/?p=php-src.git;a=commit;h=15d8c80ead75be976c18a66b0933cf52f3e6579f I believe the behavior is correct. However, these temporary fixes were reverted in master. See: http://git.php.net/?p=php-src.git;a=commit;h=f11f7f56013c5ee4e6009997602e9b5a64064909 As described in the e-mail linked above, this returns to incorrect behavior because it causes DateTime to act entirely different from every other class when an exception is thrown in the constructor. A class that extends a constructor should be allowed to do whatever is necessary to try to fix the issue and should not artificially be disallowed from accessing itself because of an exception below it. ------------------------------------------------------------------------ [2014-06-06 08:15:37] arjen at react dot com Regression was reported in https://bugs.php.net/bug.php?id=67179 Which can be closed now... ------------------------------------------------------------------------ [2014-06-05 12:51:38] remi@php.net This introduce a regression in some code. Fixed in 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-01 14:59:15] tyrael@php.net Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=c1aa9baf29d1a20fa60c1cef3979a80014f6677b Log: Fixed bug #67118 DateTime constructor crash with invalid data ------------------------------------------------------------------------ [2014-04-28 11:18:44] per at interapp dot se Hi Anatol, Thanks a lot for the fix. It is applied in production now and everything is working great. Actually we didn't believe we would be able to provide you with a code snippet for reproduction either :) Thanks once again BR Eric ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=67118 -- Edit this bug report at https://bugs.php.net/bug.php?id=67118&edit=1

« previous php.bugs (#187265) next »