Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when ISO-2022-JP-MS is specified in mb_encode_mimeheader #9683

Closed
nanasess opened this issue Oct 6, 2022 · 4 comments
Closed

Problem when ISO-2022-JP-MS is specified in mb_encode_mimeheader #9683

nanasess opened this issue Oct 6, 2022 · 4 comments

Comments

@nanasess
Copy link

nanasess commented Oct 6, 2022

Description

PHP8.0.x or earlier will decode correctly, but PHP8.1.x will output undecoded strings.

The following code:

<?php

echo mb_decode_mimeheader(mb_encode_mimeheader('1234567890123456789012', 'ISO-2022-JP-MS', 'B'));

Resulted in this output:

123456789012345678#9#0#1#2

But I expected this output instead:

1234567890123456789012

PHP Version

PHP 8.1.6

Operating System

Ubuntu 20.04

@cmb69
Copy link
Member

cmb69 commented Oct 7, 2022

Indeed, there is something wrong in PHP 8.1: https://3v4l.org/ucPUC

@alexdowad
Copy link
Contributor

@nanasess, thank you for reporting this problem! And as always, many thanks for @cmb69 and @Girgias for handling triage of incoming bug reports.

Interestingly, I have already fixed this problem in PHP-8.2+, in f3c8efd. However, the bug fix needs to be backported to PHP-8.1.

Let me work on that.

@alexdowad
Copy link
Contributor

I am also adding a regression test for this.

alexdowad added a commit that referenced this issue Oct 10, 2022
* PHP-8.1:
  Add regression test for problem with mb_encode_mimeheader reported as GH-9683
  In legacy text conversion filters, reset filter state in 'flush' function
alexdowad added a commit that referenced this issue Oct 10, 2022
* PHP-8.2:
  Add regression test for problem with mb_encode_mimeheader reported as GH-9683
  In legacy text conversion filters, reset filter state in 'flush' function
@alexdowad
Copy link
Contributor

Thanks again!

This fix will be included in the next release of PHP 8.1.

@nanasess nanasess changed the title Problem when ISO-2022-JP-MS is specified in mb_ encode_mimeheader Problem when ISO-2022-JP-MS is specified in mb_encode_mimeheader Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@nanasess @alexdowad @cmb69 and others