Skip to content

Commit 314b8ec

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix #60494: iconv_mime_decode does ignore special characters
2 parents 7e176dd + e29c946 commit 314b8ec

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ PHP NEWS
1818
- iconv:
1919
. Fixed bug #63839 (iconv_mime_decode_headers function is skipping headers).
2020
(cmb)
21+
. Fixed bug #60494 (iconv_mime_decode does ignore special characters). (cmb)
2122
. Fixed bug #55146 (iconv_mime_decode_headers() skips some headers). (cmb)
2223

2324
- intl:

ext/iconv/iconv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,10 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
15351535
break;
15361536

15371537
default: /* first letter of a non-encoded word */
1538-
_php_iconv_appendc(pretval, *p1, cd_pl);
1538+
err = _php_iconv_appendc(pretval, *p1, cd_pl);
1539+
if (err != PHP_ICONV_ERR_SUCCESS) {
1540+
goto out;
1541+
}
15391542
encoded_word = NULL;
15401543
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
15411544
scan_stat = 12;

ext/iconv/tests/bug60494.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Bug #60494 (iconv_mime_decode does ignore special characters)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('iconv')) die('skip iconv extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
var_dump(iconv_mime_decode('ä'));
10+
var_dump(iconv_mime_decode('ö'));
11+
var_dump(iconv_mime_decode('ß'));
12+
?>
13+
===DONE===
14+
--EXPECTF--
15+
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
16+
bool(false)
17+
18+
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
19+
bool(false)
20+
21+
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
22+
bool(false)
23+
===DONE===

0 commit comments

Comments
 (0)