Bug #11561: Inconsistent behavior between imap_getmailboxes and imap_getsubscribed
| From: | ed at ebrady dot net | Date: | Tue, 19 Jun 2001 15:13:23 +0000 |
| Subject: | Bug #11561: Inconsistent behavior between imap_getmailboxes and imap_getsubscribed | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57266@lists.php.net to get a copy of this message | ||
From: ed@ebrady.net
Operating system: Redhat 7.0, Linux 2.2.16-22
PHP version: 4.0.5
PHP Bug Type: IMAP related
Bug description: Inconsistent behavior between imap_getmailboxes and imap_getsubscribed
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
--
Edit Bug report at: http://bugs.php.net/?id=11561&edit=1