[php-src] Issue #8308: The return value of mb_list_encodings() doesn't contain 'SJIS-win'
| From: | sji-il | Date: | Wed, 06 Apr 2022 04:55:57 +0000 |
| Subject: | [php-src] Issue #8308: The return value of mb_list_encodings() doesn't contain 'SJIS-win' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240684@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8308
Author: sji-il
### Description
The following code:
```php
<?php
var_dump(mb_list_encodings());
```
https://3v4l.org/GH0Gj
Resulted in this output:
- contains 'SJIS-win'
But I expected this output instead:
- contains 'CP932' and 'SJIS', but no 'SJIS-win'
[As of PHP 8.1](https://github.com/php/php-src/commit/e2459857afdf70ed4bc23bc7f614e9f383eb3072),
SJIS-win is an alias of CP932, thus the return value of
[mb_list_encodings()](https://www.php.net/manual/en/function.mb-list-encodings.php) never contains
'SJIS-win'.
This breaks BC.
Some libraries have functions which receive one or more encoding names as arguments, and they often
validate the input by the return value of mb_list_encodings().
This should be reverted, or fixed, or at least documented as an incompatible change.
### PHP Version
PHP 8.1.0
### Operating System
_No response_