Bug #10536: imap_expunge() can't really expunge mail
| From: | cwyeh at ccca dot nctu dot edu dot tw | Date: | Sat, 28 Apr 2001 14:25:50 +0000 |
| Subject: | Bug #10536: imap_expunge() can't really expunge mail | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52708@lists.php.net to get a copy of this message | ||
From: cwyeh@ccca.nctu.edu.tw
Operating system: FreeBSD 4.3
PHP version: 4.0.4pl1
PHP Bug Type: IMAP related
Bug description: imap_expunge() can't really expunge mail
As I wrote the following code I found the strong situation in imap_expunge(). It will expunge mails
with odd number only but not every mail as I expected.
$mbox = imap_open("{localhost/pop3:110INBOX", "test", "test");
$num_msg = imap_num_msg($mbox);
echo "start at $num_msg...<br>";
for ( $i=1; $i<=$num_msg; $i++ ) {
imap_delete($mbox, $i);
imap_expunge($mbox);
echo "doing $i....<br>";
}
imap_expunge($mbox);
$num_msg = imap_num_msg($mbox);
echo "now is $num_msg<br>";
imap_close($mbox);
I have the following output:
start at 10...
doing 1....
doing 2....
doing 3....
doing 4....
doing 5....
doing 6....
doing 7....
doing 8....
doing 9....
doing 10....
now is 5
If I modify the code as following the problem solved:
for ( $i=1; $i<=$num_msg; $i++ ) {
imap_delete($mbox, $i);
echo "doing $i....<br>";
}
imap_expunge($mbox);
The result is coreect and all mail has been deleted.
This bug occurs if a web mail system with a pop server try to delete lots of spam at a time.
--
Edit Bug report at: http://bugs.php.net/?id=10536&edit=1