Skip to content

Commit 5003831

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix GH-8208: mb_encode_mimeheader: $indent functionality broken
2 parents b92ae85 + d0417eb commit 5003831

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ PHP NEWS
1414
classes). (ilutov)
1515
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
1616

17+
- MBString:
18+
. Fixed bug GH-8208 (mb_encode_mimeheader: $indent functionality broken).
19+
(cmb)
20+
1721
- MySQLi:
1822
. Fixed bug GH-8068 (mysqli_fetch_object creates inaccessible properties).
1923
(cmb)

ext/mbstring/libmbfl/mbfl/mbfilter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *res
17321732
mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2); /* ?= */
17331733
} else if (pe->tmpdev.pos > 0) {
17341734
if (pe->outdev.pos > 0) {
1735-
if ((pe->outdev.pos - pe->linehead + pe->tmpdev.pos) > 74) {
1735+
if ((pe->outdev.pos - pe->linehead + pe->tmpdev.pos + pe->firstindent) > 74) {
17361736
mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen);
17371737
} else {
17381738
mbfl_memory_device_output(0x20, &pe->outdev);

ext/mbstring/tests/gh8208.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-8208 (mb_encode_mimeheader: $indent functionality broken)
3+
--EXTENSIONS--
4+
mbstring
5+
--FILE--
6+
<?php
7+
$s = "[service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit unterschiedlichen";
8+
$p = 'Subject: ';
9+
var_dump(
10+
$p . mb_encode_mimeheader($s, 'UTF-8', 'Q', "\015\012", strlen($p)),
11+
mb_encode_mimeheader($p . $s, 'UTF-8', 'Q', "\015\012", 0)
12+
);
13+
?>
14+
--EXPECT--
15+
string(84) "Subject: [service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit
16+
unterschiedlichen"
17+
string(84) "Subject: [service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit
18+
unterschiedlichen"

0 commit comments

Comments
 (0)