[php-src] PR #23318: Fix GH-23094: Use byte offsets in NumberFormatter parsing
| From: | ColumbusLabs | Date: | Sun, 16 Aug 2026 14:15:28 +0000 |
| Subject: | [php-src] PR #23318: Fix GH-23094: Use byte offsets in NumberFormatter parsing | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37925@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23318
Author: ColumbusLabs
Fixes #23094.
PHP exposes NumberFormatter parsing offsets as UTF-8 byte offsets, while ICU expects UTF-16
code-unit positions. Convert the input offset before parsing and the returned offset afterward for
both parse() and parseCurrency().
This targets PHP-8.4 as the lowest actively supported branch; the equivalent C++ change can be
merged upward.
Tests:
- debug + ZTS build with ICU 78.3
- sapi/cli/php run-tests.php ext/intl/tests/gh23094.phpt ext/intl/tests/formatter_parse.phpt
ext/intl/tests/formatter_parse_currency.phpt
- sapi/cli/php run-tests.php ext/intl/tests (437 passed, 111 skipped, 1 expected failure, 0
failures)