summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-11-14 14:58:45 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2018-11-14 14:59:30 +0100
commit9a2bd2f4530412f04dbb86becf9783eb5335be7a (patch)
tree312617701fd017bcb1b6f6bcfd38b2471d154508
parent8a11c9ee7696bcf7d57014032333eb5eb5f42fab (diff)
parent211c6189f6921c17ec55a3b422ab5fa4bdd5e88f (diff)
downloadphp-git-9a2bd2f4530412f04dbb86becf9783eb5335be7a.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77147: Fix for 60494 ignores ICONV_MIME_DECODE_CONTINUE_ON_ERROR
-rw-r--r--NEWS4
-rw-r--r--ext/iconv/iconv.c6
-rw-r--r--ext/iconv/tests/bug77147.phpt21
3 files changed, 30 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index dd324d7bd2..a35d2a6b4d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.0RC6
+- iconv:
+ . Fixed bug #77147 (Fixing 60494 ignored ICONV_MIME_DECODE_CONTINUE_ON_ERROR).
+ (cmb)
+
- SOAP:
. Fixed bug #77141 (Signedness issue in SOAP when precision=-1). (cmb)
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index bd21ede5ac..d80bac77f3 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1536,7 +1536,11 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
default: /* first letter of a non-encoded word */
err = _php_iconv_appendc(pretval, *p1, cd_pl);
if (err != PHP_ICONV_ERR_SUCCESS) {
- goto out;
+ if (mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR) {
+ err = PHP_ICONV_ERR_SUCCESS;
+ } else {
+ goto out;
+ }
}
encoded_word = NULL;
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
diff --git a/ext/iconv/tests/bug77147.phpt b/ext/iconv/tests/bug77147.phpt
new file mode 100644
index 0000000000..839f8972e3
--- /dev/null
+++ b/ext/iconv/tests/bug77147.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #77147 (Fixing 60494 ignored ICONV_MIME_DECODE_CONTINUE_ON_ERROR)
+--SKIPIF--
+<?php
+if (!extension_loaded('iconv')) die('skip iconv extension not available');
+?>
+--FILE--
+<?php
+$string = <<<EOF
+Feedback-ID: 014a93e3-1f5e-4df6-b347-6b59f0f746b8:b5891053-55d1-45bc-a0b5-47a7a9b59687:email:epslh1�
+EOF;
+$headers = iconv_mime_decode_headers($string, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
+var_dump($headers);
+?>
+===DONE===
+--EXPECT--
+array(1) {
+ ["Feedback-ID"]=>
+ string(86) "014a93e3-1f5e-4df6-b347-6b59f0f746b8:b5891053-55d1-45bc-a0b5-47a7a9b59687:email:epslh1"
+}
+===DONE===