php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24707 Net_IMAP::getMailboxes()
Submitted: 2003-07-18 07:39 UTC Modified: 2003-07-20 08:21 UTC
From: developer at heino dot gehlsen dot dk Assigned:
Status: Closed Package: PEAR related
PHP Version: Irrelevant OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: developer at heino dot gehlsen dot dk
New email:
PHP Version: OS:

 

 [2003-07-18 07:39 UTC] developer at heino dot gehlsen dot dk
Description:
------------
The getMailboxes('malibox', false) matches any mailbox, that either starts or ends with 'mailbox' = ("*/mailbox" || "mailbox/*").

The function should ?? return only the mailbox that contains that exact name?...

While resolving the problem, I took the liberty to alter the code, so it is also possible to retrieve only the immediate submailboxes. I changed the second (boolean) parameter into an integer, so a third option was available without making problems with backward compatibility?

While at is, I also added the ability to use a string as the second parameter, so it is possible to use the same function for those of us, at prefer to handle the reference/mailbox stuff manually?


========================================
831,832c831,832
<     * @param string $mailbox_base         base mailbox to start the search
<     *                   $mailbox_base     if $mailbox_base == ''     then $mailbox_base is the curent selected mailbox
---
>     * @param string $reference            base mailbox to start the search
>     *                   $reference        if $reference == ''     then $reference is the curent selected mailbox
842c842
<     function getMailboxes($mailbox_base = ''  , $restriction_search = true, $returnAttributes=false )
---
>     function getMailboxes($reference = ''  , $restriction_search = 1, $returnAttributes=false )
844a845,865
>         if ( is_bool($restriction_search))
>           $restriction_search = (int) $restriction_search;
>
>         if (is_int($restriction_search)){
>           switch ($restriction_search) {
>               case 0:
>                   $mailbox = "*";
>                   break;
>               case 1:
>                   $mailbox = $reference;
>                   $reference = '%';
>                   break;
>               case 2:
>                   $mailbox = "%";
>                   break;
>           }
>         } elseif (is_string($restriction_search)){
>           $mailbox = $restriction_search;
>       } else {
>             return new PEAR_Error("UPS...");
>       }
846,850c867
<         if( $restriction_search ){
<             $mailbox_base .="*";
<         }
<
<         if( PEAR::isError( $ret = $this->cmdList('*',$mailbox_base) ) ){
---
>         if( PEAR::isError( $ret = $this->cmdList($reference, $mailbox) ) ){
========================================



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-20 08:21 UTC] damian@php.net
Commited, But changed default. (Now it retrive all mailboxes by default)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 06:01:34 2025 UTC