Skip to content

Commit d29c866

Browse files
committed
Fix GH-20674 mb_decode_mimeheader does not handle separator
`?= =?` is skipped if long term, so skip space character.
1 parent 8c24077 commit d29c866

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

ext/mbstring/mbstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6395,7 +6395,7 @@ static zend_string* mb_mime_header_decode(zend_string *input, const mbfl_encodin
63956395
p = temp;
63966396
/* Decoding of MIME encoded word was successful;
63976397
* Try to collapse a run of whitespace */
6398-
if (p < e && (*p == '\n' || *p == '\r')) {
6398+
if (p < e && (*p == '\n' || *p == '\r' || *p == ' ')) {
63996399
do {
64006400
p++;
64016401
} while (p < e && (*p == '\n' || *p == '\r' || *p == '\t' || *p == ' '));

ext/mbstring/tests/gh20674.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
GH-20674 (mb_decode_mimeheader does not handle separator)
3+
--EXTENSIONS--
4+
mbstring
5+
--FILE--
6+
<?php
7+
8+
$subject = '=?us-ascii?Q?The_PH?= =?us-ascii?Q?P_8.5?=';
9+
var_dump(mb_decode_mimeheader($subject));
10+
?>
11+
--EXPECTF--
12+
string(11) "The PHP 8.5"

0 commit comments

Comments
 (0)