|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-03-19 12:30 UTC] tomlove at gmail dot com
[2010-12-01 15:04 UTC] iliaa@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: iliaa
[2010-12-01 15:04 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ When calling iconv_mime_decode() with $mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR, the manual states that "iconv_mime_decode_headers() attempts to ignore any grammatical errors and continue to process a given header." Accordingly, B-encoded encoded-words (as per RFC 2047) are silently ignored. But when using Q (quoted-printable) encoding, encoded-words with illegal characters (> 127) cause iconv_mime_decode() to return false as if ICONV_MIME_DECODE_CONTINUE_ON_ERROR was not specified. As such it is not resilient towards malformed headers. Test script: --------------- $m = ICONV_MIME_DECODE_CONTINUE_ON_ERROR; var_dump(iconv_mime_decode("Legal encoded-word: =?utf-8?B?Kg==?= .", $m)); var_dump(iconv_mime_decode("Legal encoded-word: =?utf-8?Q?*?= .", $m)); var_dump(iconv_mime_decode("Illegal encoded-word: =?utf-8?B?".chr(0xA1)."?= .", $m)); var_dump(iconv_mime_decode("Illegal encoded-word: =?utf-8?Q?".chr(0xA1)."?= .", $m)); Expected result: ---------------- string(23) "Legal encoded-word: * ." string(23) "Legal encoded-word: * ." string(24) "Illegal encoded-word: ." string(24) "Illegal encoded-word: ." Actual result: -------------- string(23) "Legal encoded-word: * ." string(23) "Legal encoded-word: * ." string(24) "Illegal encoded-word: ." bool(false)