Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

10 views
Skip to first unread message

Jan Schneider

unread,
May 17, 2016, 4:37:49 AM5/17/16
to
----- 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 <j...@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-uns...@lists.horde.org

Herr Klaus Leithoff Stylite AG

unread,
May 19, 2016, 4:42:28 AM5/19/16
to
Dear Michael,
I bump into that problem with a googlemail-account only.
Others work fine.

The way you suggested the retrieval of the preview was tested
a couple of month ago, and we decided for the current approach
as it seemed faster, within our code-set.
But I shall test it agoin.

our code is available at
https://github.com/EGroupware/egroupware/blob/master/api/src/Mail.php

function getHeaders lines 1395 to approx 1605 is the area in question

the error is triggered when calling _headerObject->getHeaders in line 1457

Best regards
Leithoff, Klaus
0 new messages