[php-src] Issue #12505: `mb_detect_encoding()` does not terminate when called with BOM sequence for UTF-8
| From: | sebastianbergmann | Date: | Tue, 24 Oct 2023 05:49:53 +0000 |
| Subject: | [php-src] Issue #12505: `mb_detect_encoding()` does not terminate when called with BOM sequence for UTF-8 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245629@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12505
Author: sebastianbergmann
### Description
This call to
mb_detect_encoding() does not terminate with PHP 8.3:
```php
var_dump(mb_detect_encoding("\xEF\xBB\xBF", null, true));
```
With PHP 8.2, the code shown above prints string(5) "UTF-8".
This was originally reported by @nyamsprod for PHPUnit as https://github.com/sebastianbergmann/phpunit/issues/5546.
I did not have success finding the first commit that causes this using git bisect as
there were commits between PHP-8.2 and PHP-8.3 for which the build fails
(at least on my machine).
### PHP Version
PHP 8.3.0-dev (0c22276888062a87f4edbb50446387430b524790)
### Operating System
Fedora 38