mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix GH-7980: Unexpected result for iconv_mime_decode
This commit is contained in:
commit
c53455ffd7
@ -1578,6 +1578,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
}
|
||||
|
||||
err = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd);
|
||||
if (err == PHP_ICONV_ERR_SUCCESS) {
|
||||
err = _php_iconv_appendl(pretval, NULL, 0, cd);
|
||||
}
|
||||
zend_string_release_ex(decoded_text, 0);
|
||||
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
@ -1718,13 +1721,6 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
*next_pos = p1;
|
||||
}
|
||||
|
||||
if (cd != (iconv_t)(-1)) {
|
||||
_php_iconv_appendl(pretval, NULL, 0, cd);
|
||||
}
|
||||
if (cd_pl != (iconv_t)(-1)) {
|
||||
_php_iconv_appendl(pretval, NULL, 0, cd_pl);
|
||||
}
|
||||
|
||||
smart_str_0(pretval);
|
||||
out:
|
||||
if (cd != (iconv_t)(-1)) {
|
||||
|
11
ext/iconv/tests/gh7980.phpt
Normal file
11
ext/iconv/tests/gh7980.phpt
Normal file
@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug GH-7980 (Unexpected result for iconv_mime_decode)
|
||||
--EXTENSIONS--
|
||||
iconv
|
||||
--FILE--
|
||||
<?php
|
||||
$subject = '=?windows-1258?Q?DSI_Charg=E9_de_Formation_Jean_Dupont?= <jdupont@example.fr>';
|
||||
var_dump(iconv_mime_decode($subject, ICONV_MIME_DECODE_STRICT, 'UTF-8'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(57) "DSI Chargé de Formation Jean Dupont <jdupont@example.fr>"
|
Loading…
Reference in New Issue
Block a user