mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #55146: iconv_mime_decode_headers() skips some headers
This commit is contained in:
commit
50fec3be0e
1
NEWS
1
NEWS
@ -17,6 +17,7 @@ PHP NEWS
|
||||
(Andrew Nester, Laruence, Anatol)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #55146 (iconv_mime_decode_headers() skips some headers). (cmb)
|
||||
. Fixed bug #53891 (iconv_mime_encode() fails to Q-encode UTF-8 string). (cmb)
|
||||
|
||||
- libxml:
|
||||
|
@ -1545,6 +1545,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
|
||||
case 1: /* expecting a delimiter */
|
||||
if (*p1 != '?') {
|
||||
if (*p1 == '\r' || *p1 == '\n') {
|
||||
--p1;
|
||||
}
|
||||
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
|
36
ext/iconv/tests/bug55146.phpt
Normal file
36
ext/iconv/tests/bug55146.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #55146 (iconv_mime_decode_headers() skips some headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$headers = <<< HEADERS
|
||||
X-Header-One: H4sIAAAAAAAAA+NgFlsCAAA=
|
||||
X-Header-Two: XtLePq6GTMn8G68F0
|
||||
HEADERS;
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
|
||||
|
||||
$headers = <<< HEADERS
|
||||
X-Header-One: =
|
||||
X-Header-Two: XtLePq6GTMn8G68F0
|
||||
HEADERS;
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["X-Header-One"]=>
|
||||
string(24) "H4sIAAAAAAAAA+NgFlsCAAA="
|
||||
["X-Header-Two"]=>
|
||||
string(17) "XtLePq6GTMn8G68F0"
|
||||
}
|
||||
array(2) {
|
||||
["X-Header-One"]=>
|
||||
string(1) "="
|
||||
["X-Header-Two"]=>
|
||||
string(17) "XtLePq6GTMn8G68F0"
|
||||
}
|
||||
===DONE===
|
Loading…
Reference in New Issue
Block a user