From 1fbc471efea69724f0c5addd167322f0326e9520 Mon Sep 17 00:00:00 2001 From: Tem Ogunfiditimi Date: Sat, 12 Dec 2020 23:48:01 -0500 Subject: [PATCH] Examine error code returned by curl handle instead of return value from curl_exec. Using the return value from curl_exec resulted in failure on new mailboxes that did not contain any mail. Signed-off-by: Tem Ogunfiditimi Changed comparison to identical check Signed-off-by: Tem Ogunfiditmi Signed-off-by: Tem Ogunfiditimi --- lib/IMAP.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/IMAP.php b/lib/IMAP.php index 791d49a..cd5e8ec 100644 --- a/lib/IMAP.php +++ b/lib/IMAP.php @@ -98,9 +98,10 @@ class IMAP extends Base { curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'CAPABILITY'); - $canconnect = curl_exec($ch); + curl_exec($ch); + $errorcode = curl_errno($ch); - if ($canconnect) { + if ($errorcode === 0) { curl_close($ch); $uid = mb_strtolower($uid); $this->storeUser($uid, $groups);