Marc check this.
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 26 Aug 2002 09:38:08 +0000 (09:38 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 26 Aug 2002 09:38:08 +0000 (09:38 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3460 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php

index 403ce05fddfb7098fc9095103e6bc502266337ec..9c0605e38b0cf09f7dbe0a950046a30c3dfcec8f 100755 (executable)
@@ -148,7 +148,7 @@ function isSpecialMailbox( $box ) {
 
 /* Expunges a mailbox */
 function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, $id='') {
-  global $uid_support;
+    global $uid_support;
     if ($id) {
        if (is_array($id)) {
           $id = sqimap_message_list_squisher($id);
@@ -160,11 +160,14 @@ function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true,
     }
     $read = sqimap_run_command($imap_stream, 'EXPUNGE'.$id, $handle_errors,
                                $response, $message, $uid);
-    $cnt = 0;                         
-    foreach ($read as $r) {
-       if (preg_match('/^\*\s[0-9]+\sEXPUNGE/AUi',$r,$regs)) {
-          $cnt++;
-       }
+    $cnt = 0;
+    
+    if ( is_array( $read ) ) {
+        foreach ($read as $r) {
+           if (preg_match('/^\*\s[0-9]+\sEXPUNGE/AUi',$r,$regs)) {
+              $cnt++;
+           }
+        }
     }
     return $cnt; 
 }