Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Conversation

slusarz
Copy link
Contributor

@slusarz slusarz commented Feb 7, 2013

... whitespace

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

…ing whitespace

If trailing whitespace on a line is detected, mark the linebreak as a
soft linebreak.
var_dump(stream_get_contents($fd, -1, 0));
?>
--EXPECT--
string(14) "FIRST =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@smalyshev
Copy link
Contributor

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.

…ing whitespace

Second attempt: need to use lookaheadto determine whether to encode ws
@slusarz
Copy link
Contributor Author

slusarz commented Feb 25, 2013

Things should be fixed now.

@php-pulls
Copy link

Comment on behalf of stas at php.net:

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants