[dev] Horde_Imap_Client test failure with latest PHP
Remi Collet
remi at fedoraproject.org
Wed Jun 4 18:18:04 UTC 2014
(resent as attached patch seems blocked)
Until 5.4.28 and 5.5.12, Test suite was OK.
Since 5.4.29 and 5.5.13 (and 5.6.0beta3) test fails.
1) Horde_Imap_Client_DateTimeTest::testDateTimeParsing with data set #0
('12 Sep 2007 15:49:12 UT', 1189612152)
Failed asserting that 0 matches expected 1189612152.
/dev/shm/BUILD/php-horde-Horde-Imap-Client-2.21.0/Horde_Imap_Client-2.21.0/test/Horde/Imap/Client/DateTimeTest.php:53
2) Horde_Imap_Client_DateTimeTest::testDateTimeParsing with data set #1
('Fri, 06 Oct 2006 12:15:13 +0100 (GMT+01:00)', 1160133313)
Failed asserting that 0 matches expected 1160133313.
/dev/shm/BUILD/php-horde-Horde-Imap-Client-2.21.0/Horde_Imap_Client-2.21.0/test/Horde/Imap/Client/DateTimeTest.php:53
Are you aware of this ?
>From a quick look, it seems it is not (no more) possible to call a
second time the constructor, after a exception was raised.
The quick (and really dirty patch) fix this.
Probably a more clean solution is possible.
Regards,
Remi.
diff -up Horde/Imap/Client/DateTime.php.old Horde/Imap/Client/DateTime.php
--- Horde/Imap/Client/DateTime.php.old 2014-06-04 19:55:57.639700231 +0200
+++ Horde/Imap/Client/DateTime.php 2014-06-04 19:56:42.986908638 +0200
@@ -31,6 +31,7 @@ class Horde_Imap_Client_DateTime extends
$tz = new DateTimeZone('UTC');
try {
+ new DateTime($time, $tz);
parent::__construct($time, $tz);
return;
} catch (Exception $e) {}
@@ -38,6 +39,7 @@ class Horde_Imap_Client_DateTime extends
/* Bug #5717 - Check for UT vs. UTC. */
if (substr(rtrim($time), -3) === ' UT') {
try {
+ new DateTime($tim . 'C', $tz);
parent::__construct($time . 'C', $tz);
return;
} catch (Exception $e) {}
@@ -48,6 +50,7 @@ class Horde_Imap_Client_DateTime extends
$date = preg_replace("/\s*\([^\)]+\)\s*$/", '', $time, -1, $i);
if ($i) {
try {
+ new DateTime($date, $tz);
parent::__construct($date, $tz);
return;
} catch (Exception $e) {}
More information about the dev
mailing list