Skip to content

Require ext-mbstring, which the parser already needs - #278

Open
Amoifr wants to merge 1 commit into
Masterminds:masterfrom
Amoifr:fix-203-require-ext-mbstring
Open

Require ext-mbstring, which the parser already needs#278
Amoifr wants to merge 1 commit into
Masterminds:masterfrom
Amoifr:fix-203-require-ext-mbstring

Conversation

@Amoifr

@Amoifr Amoifr commented Sep 4, 2026

Copy link
Copy Markdown

Fixes #203

CharacterReference::lookupDecimal() calls mb_decode_numericentity() with no guard, so a system without mbstring gets a fatal on an undefined function rather than being turned away by Composer. Declaring the extension does not restrict anything in practice, it makes an existing requirement visible.

Once it is required, the fallbacks in UTF8Utils are unreachable, so countChars() keeps only mb_strlen() and convertToUTF8() only the branch it already preferred. The iconv path was reached only without mbstring, and never for the auto encoding, where it threw instead. The Exception import goes with it.

One thing from @alecpl's list is already done: utf8_decode() is gone from the code base, so nothing is left to do there.

167 tests green. The three PHPUnit deprecations are the same on master. No CI job disables mbstring, so nothing depended on the removed branches.

CharacterReference::lookupDecimal() calls mb_decode_numericentity() with no
guard, so a system without mbstring gets a fatal on an undefined function
instead of being turned away by Composer.

Declaring the extension makes the fallbacks in UTF8Utils unreachable, so
countChars() keeps only mb_strlen() and convertToUTF8() only the branch it
already preferred. The iconv path was reached only without mbstring, and
never for the 'auto' encoding, where it threw instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ext-mbstring should be required

1 participant