Zend_Mime_Message::createFromMessage

2 messages Options
Embed this post
Permalink
Piotr Kabaciński

Zend_Mime_Message::createFromMessage

Reply Threaded More More options
Print post
Permalink
Hello,

I'm trying to fetch emails using pop3 protocol and then extract
attachments from them.

$mail = new Zend_Mail_Storage_Pop3(array(...));

foreach ($mail as $m) {
   $ct = Zend_Mime_Decode::splitHeaderField($m->getHeader('Content-Type'));

   $mime = Zend_Mime_Message::createFromMessage($m, $ct['boundary']);

   $p = $mime->getPartContent(1);
}

I'm not sure if everything is called correctly but i get following result:

Warning: base64_encode() expects parameter 1 to be string, array given
in /home/kabot/www/flyemtel/includes/external/Zend/Mime.php on line 174

It looks like attachment encoded in base64 is forced to second encoding.
What do you think about this, is it error in Zend_Mime or am i doing
something wrong?


regards
--
Piotr Kabacinski
dmuir

Re: Performance of Zend_Db_Select with named binding

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Out of curiosity, is named binding select statements faster for repeated queries than using the regular quoted string syntax?

The API docs reference these 3 methods:

 // simplest but non-secure
 $select->where("id = $id");

  // secure (ID is quoted but matched anyway)
 $select->where('id = ?'$id); 

 // alternatively, with named binding
$select->where('id = :id');


In the last one, the actual value isn't quoted into the string, so you end up with a prepared statement without the values embedded, while the former two will result in a completely different query in each iteration.

Not knowing the ins and outs of query caching, I would assume that the 3rd option would be the fastest, since the query would only need to be prepared once, and then could be reused.

Can anyone confirm this?


Cheers,
David