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

Michael J Rubinsky <[email protected]>
Newsgroups gmane.comp.horde.devel
Message-ID <20160517094510.Horde.NY6ORno0FM0LRiLfkHdQlTx@h4.theupstairsroom.com>
Quoting Michael J Rubinsky <[email protected]>:

> Quoting Jan Schneider <[email protected]>:
>
>> ----- 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 <[email protected]>
>>
>> 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: [email protected]
>
>
> 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

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
smime.p7s (application/pkcs7-signature, 5.6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.