php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77082 Sequential imap_status returns previous folders totals
Submitted: 2018-10-30 00:39 UTC Modified: -
From: shafer_w2002 at yahoo dot com Assigned:
Status: Open Package: IMAP related
PHP Version: 7.2.11 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shafer_w2002 at yahoo dot com
New email:
PHP Version: OS:

 

 [2018-10-30 00:39 UTC] shafer_w2002 at yahoo dot com
Description:
------------
This bug is affecting 7.2.11 and 7.3.0RC4

If calling imap_status() on a series of mailboxes, if the mailbox has no emails in it, imap_status() returns the previous result.

I have also tried calling imap_gc() before calling imap_status() and this didn't help either.

Test script:
---------------
$folders = [
    '{localhost:143}INBOX',  // Has 3 emails, 2 unseen
    '{localhost:143}INBOX/NoEmails',  //  Has no emails
];

$connection = imap_open('{localhost:143}INBOX/NoEmails', 'user', 'password);

foreach ($folders as $folder) {
    $status = imap_status($connection, $folder, SA_ALL);  // Changing options has no effect on the result

    print_r($status);  // Always returns the results for INBOX
}

Expected result:
----------------
stdClass Object
(
    [flags] => 31
    [messages] => 3
    [recent] => 0
    [unseen] => 2
    [uidnext] => 1108
    [uidvalidity] => 1527875182
)

stdClass Object
(
    [flags] => 31
    [messages] => 0
    [recent] => 0
    [unseen] => 0
    [uidnext] => 1108
    [uidvalidity] => 1527875182
)

Actual result:
--------------
stdClass Object
(
    [flags] => 31
    [messages] => 3
    [recent] => 0
    [unseen] => 2
    [uidnext] => 1108
    [uidvalidity] => 1527875182
)

stdClass Object
(
    [flags] => 31
    [messages] => 3
    [recent] => 0
    [unseen] => 2
    [uidnext] => 1108
    [uidvalidity] => 1527875182
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 18:01:26 2019 UTC