Fix #64166: quoted-printable-encode stream filter incorrectly discarding... #272

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

slusarz commented Feb 7, 2013

... whitespace

If trailing whitespace on a line is detected, mark the linebreak as a
soft linebreak.

Fix #64166: quoted-printable-encode stream filter incorrectly discard…
…ing whitespace

If trailing whitespace on a line is detected, mark the linebreak as a
soft linebreak.
ext/standard/tests/streams/bug64166.phpt
+var_dump(stream_get_contents($fd, -1, 0));
+?>
+--EXPECT--
+string(14) "FIRST =
@smalyshev

smalyshev Feb 17, 2013

Contributor

Why this produces "FIRST{SPACE}" when quoted_printable_encode in this situation produces "FIRST=20"?

Contributor

smalyshev commented Feb 17, 2013

This patch seems to work differently with join and split writes:

<?php
$data1 = "FIRST ";
$data2 = "\nSECOND";

$fd = fopen('t', 'w+');

$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array(
        'line-break-chars' => "\n",
        'line-length' => 7
));
fwrite($fd, $data1);
fwrite($fd, $data2);
//fwrite($fd, $data1.$data2);
fclose($fd);
var_dump(file_get_contents('t'));

If I do split write, I get this:
string(13) "FIRST
SECOND"
If I do joint write, I get this:
string(14) "FIRST =
SECOND"

I don't think this is a right behavior.

Fix #64166: quoted-printable-encode stream filter incorrectly discard…
…ing whitespace

Second attempt: need to use lookaheadto determine whether to encode ws
Contributor

slusarz commented Feb 25, 2013

Things should be fixed now.

declarations should be at the top of the nearest block

Comment on behalf of stas at php.net:

merged

@php-pulls php-pulls closed this Jun 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment