[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Ilia Alshanetsky | Date: | Tue, 06 Oct 2026 00:39:19 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141991@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-10-05T20:36:03-04:00
Commit: https://github.com/php/php-src/commit/fa42fde968c6f3fdb100b0efcb2895a00b057252
Raw diff: https://github.com/php/php-src/commit/fa42fde968c6f3fdb100b0efcb2895a00b057252.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/standard: Fix convert.quoted-printable-decode of lowercase hex
Changed paths:
A ext/standard/tests/filters/qp_decode_lowercase.phpt
M NEWS
M ext/standard/filters.c
Diff:
diff --git a/NEWS b/NEWS
index 7ac3c456a81b..ddc73c19be35 100644
--- a/NEWS
+++ b/NEWS
@@ -148,6 +148,8 @@ PHP NEWS
added to an Io\Poll\Context. (Jakub Zelenka)
. Fix wordwrap() ignoring an existing break at the end of the string
(Nicolas Grekas)
+ . Fixed convert.quoted-printable-decode decoding lowercase hex digits to
+ the wrong byte. (Ilia Alshanetsky)
- Tidy:
. Fixed a use-after-free when a tidyNode is used after its document is
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 8386331ac2da..2f1766237a91 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -1007,7 +1007,7 @@ static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode
*ins
err = PHP_CONV_ERR_INVALID_SEQ;
goto out;
}
- next_char = (next_char << 4) | (*ps >= 'A' ? *ps - 0x37 : *ps - 0x30);
+ next_char = (next_char << 4) | (*ps >= 'a' ? *ps - 0x57 : (*ps >=
'A' ? *ps - 0x37 : *ps - 0x30));
scan_stat++;
ps++, icnt--;
if (scan_stat != 3) {
diff --git a/ext/standard/tests/filters/qp_decode_lowercase.phpt
b/ext/standard/tests/filters/qp_decode_lowercase.phpt
new file mode 100644
index 000000000000..50a6c454d370
--- /dev/null
+++ b/ext/standard/tests/filters/qp_decode_lowercase.phpt
@@ -0,0 +1,20 @@
+--TEST--
+convert.quoted-printable-decode: lowercase hex digits decode correctly
+--FILE--
+<?php
+foreach (['=cd', '=0a', '=da', '=CD', '=AB',
'=ab'] as $in) {
+ $fp = fopen('php://temp', 'r+');
+ fwrite($fp, $in);
+ rewind($fp);
+ stream_filter_append($fp, 'convert.quoted-printable-decode', STREAM_FILTER_READ);
+ echo $in, ' => ', bin2hex(stream_get_contents($fp)), "\n";
+ fclose($fp);
+}
+?>
+--EXPECT--
+=cd => cd
+=0a => 0a
+=da => da
+=CD => cd
+=AB => ab
+=ab => ab