From 95b90be8c22aa51f5b5e2d8bfa8031b50fa15e49 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 07 May 2013 12:19:38 -0400
Subject: [PATCH] Fix IMAP connection issue with default_socket_timeout < 0 and imap_timeout < 0 (#1489090)

---
 CHANGELOG                                    |    1 +
 program/lib/Roundcube/rcube_imap_generic.php |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 5cba239..7542fde 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix IMAP connection issue with default_socket_timeout < 0 and imap_timeout < 0 (#1489090)
 - Fix various PHP code bugs found using static analysis (#1489086)
 - Fix backslash character handling on vCard import (#1489085)
 - Fix csv import from Thunderbird with French localization (#1489059)
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index f7c1f86..6c1b855 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -746,7 +746,7 @@
         }
 
         if ($this->prefs['timeout'] <= 0) {
-            $this->prefs['timeout'] = ini_get('default_socket_timeout');
+            $this->prefs['timeout'] = max(0, intval(ini_get('default_socket_timeout')));
         }
 
         // Connect

--
Gitblit v1.9.1