[dev] Question with Horde_Imap_Client_Base::fetch() when UID no longer exists.

Michael J Rubinsky mrubinsk at horde.org
Sun Jan 20 00:31:17 UTC 2013


Quoting Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Michael M Slusarz <slusarz at horde.org>:
>
> <snip>
>
>>> What is the current/correct way of catching when the requested  
>>> email no longer exists on the IMAP server?
>>
>> $results[160571]->isDefault() !== true
>
> This is not working for me. E.g.;
>
> <code>
> $imap_ob = $registry->mail->imapOb();
> $mbox = new Horde_Imap_Client_Mailbox('INBOX');
> $query = new Horde_Imap_Client_Fetch_Query();
> $query->structure();
> $query->flags();
>
> // UID 1 does NOT exist while 160441 DOES exist.
> $ids = new Horde_Imap_Client_Ids(array(1, 160441));
>
> $results = $imap_ob->fetch($mbox, $query, array('ids' => $ids));
>
> var_dump($results[1]->isDefault());         // Outputs (bool)false
> var_dump($results[160441]->isDefault());    // Also outputs (bool)false
>
> </code>

It looks like the UID of the message is still set in the _data array  
when the message doesn't exist so empty($this->_data) will always  
return false.

<code>
var_dump($results[1]->getRawData());
var_dump($results[160441]->getRawData());
</code>

array(1) {
   [13] =>
   int(1)
}
array(3) {
   [13] =>
   int(160441)
   [10] =>
   array(1) {
     [0] =>
     string(5) "\seen"
   }
   [1] =>
   class Horde_Mime_Part#196 (22) {
     protected $_type =>
     string(4) "text"
     protected $_subtype =>
     string(5) "plain"
     protected $_contents =>
     NULL
     protected $_transferEncoding =>
     string(4) "7bit"
     protected $_language =>
     array(0) {
     }
     protected $_description =>
     string(0) ""
     protected $_disposition =>
     string(6) "inline"
     protected $_dispParams =>
     array(1) {
       'size' =>
       string(3) "915"
     }
     protected $_contentTypeParams =>
     array(3) {
       'charset' =>
       string(8) "us-ascii"
       'delsp' =>
       string(3) "Yes"
       'format' =>
       string(6) "flowed"
     }
     protected $_parts =>
     array(0) {
     }
     protected $_mimeid =>
     string(1) "1"
     protected $_eol =>
     string(1) "\n"
     protected $_temp =>
     array(0) {
     }
     protected $_metadata =>
     array(0) {
     }
     protected $_boundary =>
     NULL
     protected $_bytes =>
     int(915)
     protected $_contentid =>
     NULL
     protected $_duration =>
     NULL
     protected $_reindex =>
     bool(false)
     protected $_basepart =>
     bool(false)
     protected $_hdrCharset =>
     NULL
     protected $_serializedVars =>
     array(19) {
       [0] =>
       string(5) "_type"
       [1] =>
       string(8) "_subtype"
       [2] =>
       string(17) "_transferEncoding"
       [3] =>
       string(9) "_language"
       [4] =>
       string(12) "_description"
       [5] =>
       string(12) "_disposition"
       [6] =>
       string(11) "_dispParams"
       [7] =>
       string(18) "_contentTypeParams"
       [8] =>
       string(6) "_parts"
       [9] =>
       string(7) "_mimeid"
       [10] =>
       string(4) "_eol"
       [11] =>
       string(9) "_metadata"
       [12] =>
       string(9) "_boundary"
       [13] =>
       string(6) "_bytes"
       [14] =>
       string(10) "_contentid"
       [15] =>
       string(9) "_duration"
       [16] =>
       string(8) "_reindex"
       [17] =>
       string(9) "_basepart"
       [18] =>
       string(11) "_hdrCharset"
     }
   }
}
-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6062 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.horde.org/archives/dev/attachments/20130119/18811e2f/attachment.bin>


More information about the dev mailing list