Skip to content

mb_detect_encoding() does not terminate when called with BOM sequence for UTF-8 #12505

@sebastianbergmann

Description

@sebastianbergmann

Description

This call to mb_detect_encoding() does not terminate with PHP 8.3:

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 sebastianbergmann/phpunit#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 (0c22276)

Operating System

Fedora 38

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions