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

Michael J Rubinsky mrubinsk at horde.org
Tue May 17 13:45:10 UTC 2016


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

> Quoting Jan Schneider <jan at horde.org>:
>
>> ----- 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/
>> -- 
>> dev mailing list
>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>
>
> I believe that that value is supposed to be a Horde_Mime object of  
> some sort, not a Horde_Stream object so there might be some issue  
> there in the code path when fetching the fullText of the message. We  
> don't fetch the fullText in our code very often, if at all. I'll  
> have to look into that part of the issue.

I can't reproduce this using the code example you gave. The header  
text is always returned properly. Perhaps a more detailed code example  
that can be run in a PHP shell...


-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5751 bytes
Desc: S/MIME Signature
URL: <https://lists.horde.org/archives/dev/attachments/20160517/af6e097f/attachment-0001.bin>


More information about the dev mailing list