[Tickets #14086] Re: Image Attachments via ActiveSync: Last Byte Missing?
noreply at bugs.horde.org
noreply at bugs.horde.org
Wed Aug 19 15:56:20 UTC 2015
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: https://bugs.horde.org/ticket/14086
------------------------------------------------------------------------------
Ticket | 14086
Updated By | Michael Rubinsky <mrubinsk at horde.org>
Summary | Image Attachments via ActiveSync: Last Byte Missing?
Queue | Synchronization
Version | FRAMEWORK_5_2
Type | Bug
State | Not A Bug
Priority | 1. Low
Milestone |
Patch |
Owners | Michael Rubinsky
------------------------------------------------------------------------------
Michael Rubinsky <mrubinsk at horde.org> (2015-08-19 15:56) wrote:
To get ahead of the "I can't upgrade PHP" and "this is the version
that comes with <insert some distro here>" comments that always come
after a bug like this, I should say we won't work around this in code
since it would require holding the entire attachment in memory, thus
negating just about all of the work we do to minimize memory usage by
using streams. This could also very well hit your local php memory
limit.
HOWEVER, if someone wants to work around this locally on their own
install knowing the consequences of doing so, what you need to do is
modify
Horde_ActiveSync_Message_AirSyncBaseFileAttachment::_checkEncoding()
method to pull the stream contents into memory, perform a
base64_encode() on them, and then write it back out to another stream
to return: So replace the inner block in that method with something
like this:
if (is_resource($data)) {
rewind($data);
$temp_data = stream_get_contents($data);
$data = fopen('php://temp/', 'r+');
fwrite($data, base64_encode($temp_data));
} else {
$data = base64_encode($data);
}
More information about the bugs
mailing list