[php-src] Issue #7898: mb_convert_encoding returns empty string since PHP 8.1.0
| From: | rowhel95 | Date: | Thu, 06 Jan 2022 20:23:32 +0000 |
| Subject: | [php-src] Issue #7898: mb_convert_encoding returns empty string since PHP 8.1.0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238827@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7898
Author: rowhel95
### Description
The following code:
```php
<?php
$str = 'Test';
# Make sure string is in UTF-8 and strip invalid UTF-8 characters
$str = mb_convert_encoding($str, 'UTF-8', mb_list_encodings());
print_r($str);
```
Resulted in this output:
```
```
But I expected this output instead:
```
Test
```
This code is from a gist we use
https://gist.github.com/sgmurphy/3098978
### PHP Version
PHP 8.1.0
### Operating System
CentOS 7