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
{{ message }}
Repository navigation
ext/intl: NumberFormatter::parse() and parseCurrency() use UTF-16 offsets for UTF-8 strings #23094
The emoji occupies 4 bytes in the PHP UTF-8 string but 2 UTF-16 code units in ICU. Very sure this is the reason.
The input offset should be converted from a UTF-8 byte offset to a UTF-16 code-unit offset before calling ICU. Ehhhhhhh unfortunately I think this happens commonly throughout the code base. So I might be planning some bigger refactor to solve this. Buggy stuff /_ \
Since this is a rather easy case to solve, I will open this as an issue here. If anyone want to start a contribution to the intl extension. They can try to solve this as a good head start. This should be easier than JIT bugs anyways. Feel free to open a PR :)
Note: The bug also effects parseCurrency as they use the exact same logic. Not sure if there are any similar functions effected :/
Activity
Merge branch 'PHP-8.5'
Fix phpGH-23094: Use byte offsets in NumberFormatter parsing (php#23318)
Merge branch 'PHP-8.4' into PHP-8.5
ext/intl: Use byte offsets in IntlDateFormatter parsing
ext/intl: Use byte offsets in IntlDateFormatter parsing
ext/intl: Use byte offsets in IntlDateFormatter parsing