[Tickets #14097] PHP WARNING in Horde_Imap_Client_Socket::listMailbox

noreply at bugs.horde.org noreply at bugs.horde.org
Tue Sep 1 18:53:25 UTC 2015


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: https://bugs.horde.org/ticket/14097
------------------------------------------------------------------------------
  Ticket             | 14097
  Created By         | nicolas.vanheu at gmail.com
  Summary            | PHP WARNING in Horde_Imap_Client_Socket::listMailbox
  Queue              | Horde Framework Packages
  Type               | Bug
  State              | Unconfirmed
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


nicolas.vanheu at gmail.com (2015-09-01 18:53) wrote:

Calling Horde_Imap_Client_Socket::listMailboxes($dest_mailbox,  
Horde_Imap_Client::MBOX_ALL, ['status' =>  
Horde_Imap_Client::STATUS_MESSAGES | Horde_Imap_Client::STATUS_UNSEEN  
| Horde_Imap_Client::STATUS_UIDNEXT]); when the imap server does not  
have the capability LIST-STATUS ($this->_capability('LIST-STATUS')  
returns false) raise a php warning.

Simple fix would be to initialize $status_opts = array(); before the if.

Revelant piece of code :
/* LIST-STATUS does NOT depend on LIST-EXTENDED. */
         if (!empty($options['status']) &&
             $this->_capability('LIST-STATUS')) {
             $available_status = array(
                 Horde_Imap_Client::STATUS_MESSAGES,
                 Horde_Imap_Client::STATUS_RECENT,
                 Horde_Imap_Client::STATUS_UIDNEXT,
                 Horde_Imap_Client::STATUS_UIDVALIDITY,
                 Horde_Imap_Client::STATUS_UNSEEN,
                 Horde_Imap_Client::STATUS_HIGHESTMODSEQ
             );

             $status_opts = array();
             foreach (array_intersect($this->_statusFields,  
$available_status) as $key => $val) {
                 if ($options['status'] & $val) {
                     $status_opts[] = $key;
                 }
             }

             if (count($status_opts)) {
                 $return_opts->add(array(
                     'STATUS',
                     new Horde_Imap_Client_Data_Format_List(
                         array_map('Horde_String::upper', $status_opts)
                     )
                 ));
             }
         }

Tested with courier-imap.





More information about the bugs mailing list