Sfoglia il codice sorgente

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 anni fa
parent
commit
5ccfbf3bec
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  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 */
 /* Simply logs out the IMAP session */
 function sqimap_logout ($imap_stream) {
 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='') {
 function sqimap_capability($imap_stream, $capability='') {