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
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:
48 - 15 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC