Browse Source

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 năm trước cách đây
mục cha
commit
5ccfbf3bec
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  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='') {