[GIT-PULLS] [php-src] PR #22990: ext/intl: Refactor global error resets
[email protected] (LamentXU123) Sat, 1 Aug 2026 16:31:40 +0000
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
Pull Request: https://github.com/php/php-src/pull/22990
Author: LamentXU123
Given the intl code base is using intl_error_reset(NULL); in the start of every PHP_FUNCTION to reset the error state. I'd suggest to add something like
```c
#define PHP_INTL_FUNCTION_WITH_ERROR_RESET(name) \
static void php_intl_##name##_impl(INTERNAL_FUNCTION_PARAMETERS); \
U_CFUNC PHP_FUNCTION(name) \
{ \
intl_error_reset(NULL); \
php_intl_##name##_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU); \
} \
static void php_intl_##name##_impl(INTERNAL_FUNCTION_PARAMETERS)
```
So we can directly use the PHP_INTL_FUNCTION_WITH_ERROR_RESET macro to automatically reset error state in the start of every userland function.
I am working on this idea but this should be a massive refactor. Because I found so many cases that we forgot to reset error state in the start of php_functions that cause bugs. e.g.: #22931 #22500 and it is really annoying to add a line to reset the state in every function.