ext/intl: Fix stale intl error state in IntlNumberRangeFormatter - #23191
Open
LamentXU123 wants to merge 3 commits into
Open
ext/intl: Fix stale intl error state in IntlNumberRangeFormatter#23191LamentXU123 wants to merge 3 commits into
LamentXU123 wants to merge 3 commits into
Conversation
devnexen
reviewed
Aug 9, 2026
| intl_error_reset(NULL); | ||
|
|
||
| IntlNumberRangeFormatter_object* obj = Z_INTL_RANGEFORMATTER_P(ZEND_THIS); | ||
| intl_error_reset(RANGEFORMATTER_ERROR_P(obj)); |
Member
There was a problem hiding this comment.
This reset is a no-op: every failure path calls intl_error_set(NULL, ...),
which only writes the global error, so the object slot is never set.
Switch the two calls in format() to
intl_errors_set(RANGEFORMATTER_ERROR_P(obj), ...), then getErrorCode()
stops always returning U_ZERO_ERROR.
Member
|
ok otherwise.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IntlNumberRangeFormatter::createFromSkeleton() and IntlNumberRangeFormatter::format() did not reset intl error state
I know this is yet another "error state" fixes. Unfortunately we couldn't use the function macro added before because these are methods, and we can only reset the error state manually so far.
I personally hate the error state design. I think we should throw exceptions instead. But considering BC breaks... this is just an idea in the void.
IntlNumberRangeFormatter is added in 8.6 so this is the correct branch.