From efd14442b0b1934394b1ab946ddc703fe6b3c0a3 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sun, 5 Jul 2009 23:17:22 -0600 Subject: [PATCH] Fix rewind of stream --- framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php index 76de7498a..b241b7429 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php @@ -896,12 +896,11 @@ class Horde_Imap_Client_Socket_Pop3 extends Horde_Imap_Client_Base case Horde_Imap_Client::FETCH_STRUCTURE: foreach ($seq_ids as $id) { - if ($tmp = $this->_pop3Cache('msg', $id)) { + $tmp = false; + if ($ptr = $this->_pop3Cache('msg', $id)) { try { - $tmp = Horde_Mime_Part::parseMessage(stream_get_contents($tmp), array('structure' => empty($c_val['parse']))); - } catch (Horde_Exception $e) { - $tmp = false; - } + $tmp = Horde_Mime_Part::parseMessage(stream_get_contents($ptr), array('structure' => empty($c_val['parse']))); + } catch (Horde_Exception $e) {} } $ret[$id]['structure'] = $tmp; } @@ -989,6 +988,9 @@ class Horde_Imap_Client_Socket_Pop3 extends Horde_Imap_Client_Base protected function _pop3Cache($type, $index = null, $data = null) { if (isset($this->_temp['pop3cache'][$index][$type])) { + if ($type == 'msg') { + rewind($this->_temp['pop3cache'][$index][$type]); + } return $this->_temp['pop3cache'][$index][$type]; } -- 2.11.0