[dev] quoted-printable-encode issue (Was Re: [commits] Horde branch master updated. 96483e0d91a027c338b703995e0b123b31684488)

Michael J Rubinsky mrubinsk at horde.org
Fri Sep 27 18:52:21 UTC 2013


Quoting Michael M Slusarz <slusarz at horde.org>:

> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>
>
>> Ok. Going to report this to the PHP folks, but, Michael, can you  
>> take a look at this test case and double check that this makes  
>> sense? The following code segfaults:
>>
>> $data = fopen('php://temp', 'r+');
>> fwrite($data, "test\r\ntest\r\n\r");
>>
>> $stream = fopen("php://temp", 'r+');
>> stream_filter_append($stream, 'convert.quoted-printable-encode',  
>> STREAM_FILTER_WRITE, array('line-length' => 5, 'line-break-chars'  
>> => "\r\n"));
>> rewind($data);
>> stream_copy_to_stream($data, $stream);
>
> I can verify.  Yes, it does look like the line-break-chars are what  
> is breaking, since removing the bare "\r" fixes things.
>
> Report the PHP bug ID back here.

https://bugs.php.net/bug.php?id=65776

> When I get back from camping this weekend, I can take a look at the  
> PHP source myself.  I recently submitted patches to fix white-space  
> padding in the PHP source, so I am familiar with the code.  I don't  
> *think* my changes are what causes this issue... because quite  
> frankly having a file with that kind of EOLs is rare.

Indeed, which is why it took me so fracking long to track down the failure :)


> FWIW, you can normalize EOLs in your input data using  
> Horde_Stream_Filter_Eol (or similar) so you never trigger this  
> faulty PHP code.

Thanks for the hint.
-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5849 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/dev/attachments/20130927/c59b90fb/attachment.bin>


More information about the dev mailing list