Re: Re: com php-src: Fixed bug #67118 DateTime constructor crash with invalid data: NEWS ext/date/php_date.c ext/date/tests/bug67118.phpt
| From: | Remi Collet | Date: | Wed, 04 Jun 2014 18:41:26 +0000 |
| Subject: | Re: Re: com php-src: Fixed bug #67118 DateTime constructor crash with invalid data: NEWS ext/date/php_date.c ext/date/tests/bug67118.phpt | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74745@lists.php.net to get a copy of this message | ||
Le 04/06/2014 20:25, Remi Collet a écrit :
> Le 25/04/2014 17:23, Anatol Belski a écrit :
>> Commit: c1aa9baf29d1a20fa60c1cef3979a80014f6677b
>> Author: Anatol Belski <ab@php.net> Fri, 25 Apr 2014 17:23:26 +0200
>> Parents: 03c703b8bd55679edf30fe17529fab0c2281b01f
>> Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
>>
>> Link:
>> http://git.php.net/?p=php-src.git;a=commitdiff;h=c1aa9baf29d1a20fa60c1cef3979a80014f6677b
>
>
> It seems this fix breaks Horde (Horde_Imap_Client).
>
> Here is the code:
>
>
> https://github.com/horde/horde/blob/master/framework/Imap_Client/lib/Horde/Imap/Client/DateTime.php
>
> If first __construct call fails, this=NULL and other call have no effect.
>
> Probably the code seems a bit ugly... but...
>
> Any idea ?
> - realloc "this" before php_date_initialize ?
>
> Remi.
>
>
Simple reproducer:
<?php
class Foo extends DateTime {
public function __construct($time = null) {
$tz = new DateTimeZone('UTC');
try {
echo "First try\n";
parent::__construct($time, $tz);
return;
} catch (Exception $e) {
echo "Second try\n";
parent::__construct($time.'C', $tz);
}
}
}
$date = '12 Sep 2007 15:49:12 UT';
var_dump(new Foo($date));
Works with php 5.4.28, 5.5.12
Return NULL with php 5.4.29, 5.5.13 and 5.6.0beta3
Remi.