Skip to content

Commit 211c618

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix #77147: Fix for 60494 ignores ICONV_MIME_DECODE_CONTINUE_ON_ERROR
2 parents ce4eb89 + a56cdd0 commit 211c618

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PHP NEWS
66
. Fixed bug #77095 (slowness regression in 7.2/7.3 (compared to 7.1)).
77
(Anatol)
88

9+
- iconv:
10+
. Fixed bug #77147 (Fixing 60494 ignored ICONV_MIME_DECODE_CONTINUE_ON_ERROR).
11+
(cmb)
12+
913
- ODBC:
1014
. Fixed bug #77079 (odbc_fetch_object has incorrect type signature).
1115
(Jon Allen)

ext/iconv/iconv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,11 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
15371537
default: /* first letter of a non-encoded word */
15381538
err = _php_iconv_appendc(pretval, *p1, cd_pl);
15391539
if (err != PHP_ICONV_ERR_SUCCESS) {
1540-
goto out;
1540+
if (mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR) {
1541+
err = PHP_ICONV_ERR_SUCCESS;
1542+
} else {
1543+
goto out;
1544+
}
15411545
}
15421546
encoded_word = NULL;
15431547
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {

ext/iconv/tests/bug77147.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #77147 (Fixing 60494 ignored ICONV_MIME_DECODE_CONTINUE_ON_ERROR)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('iconv')) die('skip iconv extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$string = <<<EOF
10+
Feedback-ID: 014a93e3-1f5e-4df6-b347-6b59f0f746b8:b5891053-55d1-45bc-a0b5-47a7a9b59687:email:epslh1�
11+
EOF;
12+
$headers = iconv_mime_decode_headers($string, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
13+
var_dump($headers);
14+
?>
15+
===DONE===
16+
--EXPECT--
17+
array(1) {
18+
["Feedback-ID"]=>
19+
string(86) "014a93e3-1f5e-4df6-b347-6b59f0f746b8:b5891053-55d1-45bc-a0b5-47a7a9b59687:email:epslh1"
20+
}
21+
===DONE===

0 commit comments

Comments
 (0)