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
When using the Console table helper, the following exception is sometimes thrown : Invalid "UTF-8" string.. I've found the cause to be the following line, which may split an UTF-8 character badly when the cell text is wrapped on multiple line.
Just replacing substr with mb_substr would break things entirely (even for cases where the current logic is lucky enough to avoid breaking UTF-8 codepoints). mb_substr expects an offset computed in codepoints, not in bytes, so the computation of the offset needs to be changed as well
Symfony version(s) affected
6.4
Description
When using the Console table helper, the following exception is sometimes thrown :
Invalid "UTF-8" string.
. I've found the cause to be the following line, which may split an UTF-8 character badly when the cell text is wrapped on multiple line.https://github.com/symfony/console/blob/3e36da1448dd7bd64e623135da852858ec6fb72e/Formatter/OutputFormatter.php#L172
applyCurrentStyle
will indeed receive an Invalid "UTF-8" string because of the result ofsubstr
:Explanation : https://www.php.net/manual/en/function.substr.php#90581
How to reproduce
Code :
Run :
Result should be :
Possible Solution
Replacing
substr
withmb_substr
on this line will solve the issue. However it might be prudent to check ifmb_substr
should be used elsewhere.Additional Context
No response
The text was updated successfully, but these errors were encountered: