You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If mb_internal_encoding() is anything but UTF-8 and a multibyte character is used before an inline link, output will be garbage such as ABC ÀÀ [label](url) -> ABC ÀÀ [l[bel](url).
Bug is caused by a mb_strlen call not passing encoding in InlineParserEngine.
A quick regex search found 11 similar calls. Some may be safe because they don't expect multibyte input (URI cannot be multibyte in markdown). In this case they should be converted to non multibyte calls to avoid the confusion.
How to reproduce
mb_internal_encoding('iso-8859-1');
(new CommonMarkConverter)->convert('AAA ÀÀ [label][(https://url)');
The text was updated successfully, but these errors were encountered:
Thanks for the report! I've fixed this via #952 (released as version 2.3.8) which also includes a custom phpstan rule to ensure we don't forget to pass the encoding in the future :)
Version(s) affected
2.3.7
Description
If
mb_internal_encoding()
is anything but UTF-8 and a multibyte character is used before an inline link, output will be garbage such asABC ÀÀ [label](url)
->ABC ÀÀ [l[bel](url)
.Bug is caused by a
mb_strlen
call not passing encoding inInlineParserEngine
.A quick regex search found 11 similar calls. Some may be safe because they don't expect multibyte input (URI cannot be multibyte in markdown). In this case they should be converted to non multibyte calls to avoid the confusion.
How to reproduce
The text was updated successfully, but these errors were encountered: