瀏覽代碼

In sqimap_logout, check if we have a stream to logout to.
If we don't, logging out is not neccessary.
This prevents an endless loop of fgets when there's no connection anymore.

Thijs Kinkhorst 23 年之前
父節點
當前提交
5ccfbf3bec
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      functions/imap_general.php

+ 4 - 2
functions/imap_general.php

@@ -257,8 +257,10 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
 
 /* Simply logs out the IMAP session */
 function sqimap_logout ($imap_stream) {
-    /* Logout is not valid until the server returns 'BYE' */
-    sqimap_run_command($imap_stream, 'LOGOUT', false, $response, $message);
+    /* Logout is not valid until the server returns 'BYE'
+     * If we don't have an imap_ stream we're already logged out */
+    if(isset($imap_stream))
+        sqimap_run_command($imap_stream, 'LOGOUT', false, $response, $message);
 }
 
 function sqimap_capability($imap_stream, $capability='') {