php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76958 Broken UTF7-IMAP conversion
Submitted: 2018-10-02 06:38 UTC Modified: 2018-10-02 14:17 UTC
From: alec@php.net Assigned: nikic (profile)
Status: Closed Package: mbstring related
PHP Version: 7.3.0RC2 OS: Linux
Private report: No CVE-ID: None
 [2018-10-02 06:38 UTC] alec@php.net
Description:
------------
I'm testing PHP 7.3.0RC2 (cli) (built: Oct  1 2018 11:46:48) ( NTS ) Ondrej's PPA on Ubuntu 18.04. It looks like conversion to/from UTF7-IMAP encoding is broken. See simple test script. It works as expected on PHP <= 7.2.



Test script:
---------------
$str = '&BCAEMARBBEEESwQ7BDoEOA-';
echo mb_convert_encoding($str, 'UTF-8', 'UTF7-IMAP') . "\n";
$str = 'Рассылки';
echo mb_convert_encoding($str, 'UTF7-IMAP', 'UTF-8') . "\n";

Expected result:
----------------
Рассылки
&BCAEMARBBEEESwQ7BDoEOA-


Actual result:
--------------
BCAEMARBBEEESwQ7BDoEOA-
 0AAK;:8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-02 06:49 UTC] alec@php.net
Sorry, I cut one character from the actual result. It looks like this:

&BCAEMARBBEEESwQ7BDoEOA-
 0AAK;:8
 [2018-10-02 09:14 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-10-02 09:14 UTC] cmb@php.net
Confirmed: <https://3v4l.org/4WIAn>.
 [2018-10-02 12:56 UTC] nikic@php.net
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2018-10-02 12:56 UTC] nikic@php.net
Looks like I missed this encoding when moving convert_vtbl pointers into mbfl_encoding.
 [2018-10-02 14:15 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=26f82a77061b7389c4507a2277643139339b430b
Log: Fixed bug #76958
 [2018-10-02 14:15 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 [2018-10-02 14:17 UTC] nikic@php.net
Some additional hardening implemented in https://github.com/php/php-src/commit/9cfd8f43c2a6386bcf1567a5c0de47dcb182b109, to make sure that such issues result in an error, rather than mbstring doing god knows what.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Dec 13 22:01:26 2018 UTC