10 Commits
Author SHA1 Message Date
Gina Peter Banyard c0250bac3a intl: stop including headers as C extern (#24617)
Except for arginfo header as PHP_FUNCTION/PHP_METHOD are marked as U_CFUNC and the `ext/date/php_date.h` header doesn't use extern C.

We now specificy the header symbols that _need_ to follow the C function ABI, meaning in some places we drop U_CFUNC declarations and in others we add it.

Also use the `BEGIN_EXTERN_C()` portability macro when possible so that searching for this is easier.
2026-10-23 21:51:52 +01:00
Gina Peter Banyard 16375e4081 intl: replace U_CFUNC by static for some functions 2026-10-23 19:10:20 +01:00
Weilin Du 54b58d5608 ext/intl: Refactor global error resets (#22990)
Introduce PHP_INTL_FUNCTION_WITH_ERROR_RESET macro to standardize
and automate the global Intl error state reset at the start of
every userland PHP_FUNCTION. Also change the IC_METHOD function
to automatically reset error state in the start of the defined function.

The macro wraps the function entry point, performs
intl_error_reset(NULL), and delegates the actual logic to a
separate _impl function. This reduces boilerplate and prevents
bugs caused by missing error resets, as seen in GH-22931 and
GH-22500.

This refactor applies to all functions with a manual reset call
and does not affect internal helper functions that handle errors
independently.
2026-08-03 00:13:33 +08:00
Weilin Du 8613e0ebdb ext/Intl: Add UNEXPECTED() in obvious error path (#22601)
This added `UNEXPECTED()` in several obvious error path for optimization
in ext/intl.
2026-07-05 20:10:00 +08:00
Xuyang Zhang 8247706751 ext/intl: Pre-size arrays created from ICU enumerations (#22483)
Use uenum_count() to pre-size arrays built from ICU enumerations.

This avoids unnecessary HashTable growth in transliterator_list_ids(),
resourcebundle_locales() and locale_get_keywords().

locale_get_keywords() also uses the keyword length reported by ICU when
inserting the associative entry, with a fallback to strlen() for unknown
lengths.

If counting fails, the previous behavior is preserved by falling back to an
unsized array initialization.
2026-06-27 18:08:38 +08:00
Weilin Du cff33786f6 ext/intl: add const qualifiers (#22465)
Add several const qualifiers.
2026-06-26 20:34:56 +08:00
Weilin Du 42cc4adb1b ext/intl: Fix ResourceBundle fallback-disabled error message (#22236)
Fix the typo in ResourceBundle fallback-disabled error message
2026-06-07 16:48:42 +08:00
Tim Düsterhus 7114314c5a tree-wide: Replace XtOffsetOf by its definition (#21899)
`offsetof()` is in `stddef.h` and thus always available. The extra macro is an
unnecessary layer of indirection.
2026-04-28 22:12:56 +02:00
Ben Ramsey bb068359d4 license-update: ext/intl source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
David CARLIER e97c0dc340 ext/intl: migrate C to C++ code step 5. (#20424) 2025-11-09 21:57:25 +00:00