#24707 [NEW]: Net_IMAP::getMailboxes()

From: Date: Fri, 18 Jul 2003 12:39:39 +0000
Subject: #24707 [NEW]: Net_IMAP::getMailboxes()
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18379@lists.php.net to get a copy of this message
From: developer at heino dot gehlsen dot dk Operating system: Debian PHP version: Irrelevant PHP Bug Type: PEAR related Bug description: Net_IMAP::getMailboxes() 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) ) ){ ======================================== -- Edit bug report at http://bugs.php.net/?id=24707&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24707&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24707&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24707&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24707&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24707&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24707&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24707&r=support Expected behavior: http://bugs.php.net/fix.php?id=24707&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24707&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24707&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24707&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24707&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24707&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24707&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24707&r=gnused

« previous php.pear.dev (#18379) next »