php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11561 Inconsistent behavior between imap_getmailboxes and imap_getsubscribed
Submitted: 2001-06-19 11:13 UTC Modified: 2002-05-28 13:02 UTC
From: ed at ebrady dot net Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.0.5 OS: Redhat 7.0, Linux 2.2.16-22
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 + 21 = ?
Subscribe to this entry?

 
 [2001-06-19 11:13 UTC] ed at ebrady dot net
Hello,

According to the PHP4 documentation,  the functions imap_getsubscribed and imap_getmailboxes are supposedly identical except imap_getsubscribed returns just the subscribed mailboxes and imap_getmailboxes returns all mailboxes.

This seems to be true everywhere except the for the attributes bitmask.

Running the following program on one of my imap mailboxes returns the following output.

PROGRAM:
<?
$mbox = imap_open ("{localhost:143}", "username", "password"
,OP_HALFOPEN);

echo "<p><h1>Mailboxes</h1>\n";
$folders = imap_getmailboxes ($mbox, "{localhost:143}", "*");

if ($folders == false) {
    echo "Call failed<br>\n";
} else {
    while (list ($key, $val) = each ($folders)) {
        
    print "($key) ";
    print imap_utf7_decode($val->name).",";
    print "'".$val->delimiter."',";
    print $val->attributes."<br>\n";
    }
}
?>

OUTPUT:
(0) {localhost:143}Sent Items,'/',1
(1) {localhost:143}Drafts,'/',1
(2) {localhost:143}PHP,'/',2
(3) {localhost:143}PHP/Inbox,'/',1
(4) {localhost:143}PHP/Saved,'/',1
(5  {localhost:143}Sendmail,'/',2
(6) {localhost:143}Sendmail/Inbox,'/',1
(7) {localhost:143}Sendmail/Saved,'/',1
(8)  localhost:143}INBOX,'',1

The attributes for printed out are correct.  ( However I am 100% clear on  what the attributes LATT_MARKED and LATT_UNMARKED mean. )

After replacing the following line from the program above:
$folders = imap_getmailboxes $mbox, "{localhost:143}", "*");

With this one:
$folders=imap_getsubscribed ($mbox, "{localhost:143}", "*");

I now get the following output...

(0) {localhost:143}Sent Items,'/',0
(1) {localhost:143}Drafts,'/',0
(3) {localhost:143}Sendmail,'/',0
(4) {localhost:143}Sendmail/Inbox,'/',0
(5) {localhost:143}Sendmail/Saved,'/',0
(6) {localhost:143}PHP,'/',0
(7) {localhost:143}PHP/Inbox,'/',0
(8) {localhost:143}PHP/Saved,'/',0
(9) {localhost:143}INBOX,'',1

As you can see, I have lost the attribute information for each mailbox when using imap_getsubscribed.  Particuarly I have lost the LATT_SUBSCRIBED, and LATT_NOSELECT information.  

According the documentation, I assumed the behavior of these two functions should be similiar.

Excerpt of documentation from imap_getmailboxes().
____________________________________________________

Returns an array of objects containing mailbox information. Each object has the attributes name, specifying the full name of the mailbox; delimiter, which is the hierarchy delimiter for the part of the hierarchy this mailbox is in; and attributes. Attributes is a bitmask that can be tested against: 


LATT_NOINFERIORS - This mailbox has no "children" (there are no mailboxes below this one). 

LATT_NOSELECT - This is only a container, not a mailbox - you cannot open it. 

LATT_MARKED - This mailbox is marked. Only used by UW-IMAPD. 

LATT_UNMARKED - This mailbox is not marked. Only used by UW-IMAPD. 

_________________________________________________________


I am running a Redhat 7.0 system with apache 1.3.20, with
mod_ssl-2.8.4-1.3.20, mysql-max-3.23.38, php-4.0.5 

Is this a bug or am I doing something wrong???

Ed Brady 
ed@.ebrady.net

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-28 13:02 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2002-12-07 18:07 UTC] tfrank at registrar dot uoguelph dot ca
I would like to add that this is still an issue with PHP 4.2.2   available with RedHat 8.0.  I haven't tried 4.2.3 or any 4.3 betas, but it doesn't seem to have gone away so far.

Tim
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC