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

Michael M Slusarz slusarz at horde.org
Fri Sep 27 18:36:22 UTC 2013


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.  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.

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

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list