[dev] Fwd: Hi Jan, I have a question regarding the use of Horde_Stream_Temp when fetching headers

Jan Schneider jan at horde.org
Tue May 17 08:37:01 UTC 2016


----- Weitergeleitete Nachricht von Herr Klaus Leithoff Stylite AG -----
  Datum: Tue, 17 May 2016 10:24:46 +0200
Betreff: Hi Jan, I have a question regarding the use of  
Horde_Stream_Temp when fetching headers
     An: Jan Schneider <jan at horde.org>

Hi Jan,
I have a question regarding the use of Horde_Stream_Temp when fetching  
headers.
Outline:
In our EGroupare-Mail-Module, we implemented the possibility to have a  
"preview"
of the first few lines of a mail (like most mobile apps do it) in the  
list of available
mails. To achieve that, together with an
fquery = new Horde_Imap_Client_Fetch_Query();
fquery->headers(...)
we query for
fquery->fullText(peek=>true, length=>5000, start=>0)

when actually retrieving the headers, I bump into a Fatal, when accessing my
googlemail-account.Imap/Client/Data/Fetch.php Line 628 Call to  
undefined method Horde_Stream_Temp::toString() (this is within  
_getHeaders(...) ) we use pear-pear.horde.org/Horde_Imap_Client
Version 2.29.6

I worked around the problem with:
Horde_Imap_Client/Horde/Imap/Client/Data/Fetch.php Line 607
return  
is_resource($this->_data[$key][$id]->stream)?Horde_Mime_Headers::parseHeaders(stream_get_contents($this->_data[$key][$id]->stream,-1,0)):clone  
$this->_data[$key][$id];

and Line 628
return  
is_resource($this->_data[$key][$id]->stream)?Horde_Mime_Headers::parseHeaders(stream_get_contents($this->_data[$key][$id]->stream,-1,0)):$this->_data[$key][$id]->toString(
                    array('nowrap' => true)
                );

I am aware, that working around the issue is most probably NOT the way  
the issue should be handeled, and that the way I do it, is
probably not the most effective or desired way to do it.
The question is HOW to handle the issue, or avoid it alltogether. 
It seems to be triggered by the expectation that header-Data may not  
be of type stream.

The way the temp stream stuff is done, it seems, if string is exeeding  
a certain length its handeled
as stream, and this seems not to be expected in _getHeaders

Any idea where to dig in and handle it in a way that it is done properly ?

Best regards

​Klaus Leithoff STYLITE AG
----- Ende der weitergeleiteten Nachricht -----
-------------------------
Jan Schneider
The Horde Project
http://www.horde.org/


More information about the dev mailing list