Hi Bartosz!
The mail number starts with 1. You initialize the LimitIterator with 0
instead of 1, which throws an exception (try $mail[0];). Seems like
iterator_to_array() eats that exception.
If you don't need an array, and I don't see a reason, I would also
avoid converting the iterator to an array. Mail storage classes can be
used like an array and most of the time you'd use foreach, which works
with every iterator.
nico
Bartosz Maciaszek wrote:
Hello everyone,
I'd like to limit the Zend_Mail_Storage_Imap iterator using
LimitIterator, so what I do is:
$mail = new Zend_Mail_Storage_Imap(array('host' => localhost,
'user' => 'test',
'password' => 'secret'));
$mail = new LimitIterator($mail, 0, 50);
print_r(iterator_to_array($mail));
But all I get is empty array. Am I doing something wrong or the
implementation od Zend_Mail_Storage_* is incorrect?
Regards,
Bartosz