Skip to content

Commit b5afc99

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #60494: iconv_mime_decode does ignore special characters
2 parents 065eee1 + 314b8ec commit b5afc99

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
@@ -19,6 +19,7 @@ PHP NEWS
1919
- iconv:
2020
. Fixed bug #63839 (iconv_mime_decode_headers function is skipping headers).
2121
(cmb)
22+
. Fixed bug #60494 (iconv_mime_decode does ignore special characters). (cmb)
2223
. Fixed bug #55146 (iconv_mime_decode_headers() skips some headers). (cmb)
2324
. Fixed bug #53891 (iconv_mime_encode() fails to Q-encode UTF-8 string). (cmb)
2425

ext/iconv/iconv.c

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

15361536
default: /* first letter of a non-encoded word */
1537-
_php_iconv_appendc(pretval, *p1, cd_pl);
1537+
err = _php_iconv_appendc(pretval, *p1, cd_pl);
1538+
if (err != PHP_ICONV_ERR_SUCCESS) {
1539+
goto out;
1540+
}
15381541
encoded_word = NULL;
15391542
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
15401543
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)