Skip to content

Commit

Permalink
[mms] Workaround PHP DateTime regression in 5.4.29 & 5.5.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Jun 9, 2014
1 parent 5dc1540 commit 791fb9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion framework/Imap_Client/lib/Horde/Imap/Client/DateTime.php
Expand Up @@ -26,18 +26,26 @@ class Horde_Imap_Client_DateTime extends DateTime
{
/**
*/
public function __construct($time = null)
public function __construct($time = null, $tz = null)
{
/* See https://bugs.php.net/bug.php?id=67118 */
$bug_67118 = in_array(PHP_VERSION, array('5.4.29', '5.5.13'));
$tz = new DateTimeZone('UTC');

try {
if ($bug_67118) {
new DateTime($time, $tz);
}
parent::__construct($time, $tz);
return;
} catch (Exception $e) {}

/* Bug #5717 - Check for UT vs. UTC. */
if (substr(rtrim($time), -3) === ' UT') {
try {
if ($bug_67118) {
new DateTime($time . 'C', $tz);
}
parent::__construct($time . 'C', $tz);
return;
} catch (Exception $e) {}
Expand All @@ -48,6 +56,9 @@ public function __construct($time = null)
$date = preg_replace("/\s*\([^\)]+\)\s*$/", '', $time, -1, $i);
if ($i) {
try {
if ($bug_67118) {
new DateTime($date, $tz);
}
parent::__construct($date, $tz);
return;
} catch (Exception $e) {}
Expand Down
2 changes: 2 additions & 0 deletions framework/Imap_Client/package.xml
Expand Up @@ -21,6 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Workaround PHP DateTime regression in 5.4.29 &amp; 5.5.13.
* [mms] Fix translating error messages if they contain printf placeholders.
</notes>
<contents>
Expand Down Expand Up @@ -2453,6 +2454,7 @@
<date>2014-06-04</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Workaround PHP DateTime regression in 5.4.29 &amp; 5.5.13.
* [mms] Fix translating error messages if they contain printf placeholders.
</notes>
</release>
Expand Down

0 comments on commit 791fb9e

Please sign in to comment.