[php-src] PR #22870: Fix convert.quoted-printable-decode of lowercase hex digits
| From: | iliaal | Date: | Thu, 23 Jul 2026 14:05:10 +0000 |
| Subject: | [php-src] PR #22870: Fix convert.quoted-printable-decode of lowercase hex digits | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37248@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22870
Author: iliaal
The convert.quoted-printable-decode stream filter accepts lowercase hex digits (isxdigit() passes
a-f) but its nibble math only handles uppercase, so a hex escape with a lowercase digit decodes to
the wrong byte. quoted_printable_decode() decodes lowercase correctly, so the filter and the
function disagree.
$fp = fopen('php://temp', 'r+');
fwrite($fp, '=cd'); rewind($fp);
stream_filter_append($fp, 'convert.quoted-printable-decode', STREAM_FILTER_READ);
var_dump(bin2hex(stream_get_contents($fp))); // "ed", should be "cd"