Skip to content

ext/intl: Fix NumberFormatter symbol range check on truncated values - #25425

Closed
jorgsowa wants to merge 2 commits into
php:PHP-8.6from
jorgsowa:fix-intl-numfmt-symbol-range
Closed

jorgsowa wants to merge 2 commits into
php:PHP-8.6from
jorgsowa:fix-intl-numfmt-symbol-range

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

getSymbol()/setSymbol() cast the zend_long to UNumberFormatSymbol before range-checking it, so values like 2**32 wrapped into the valid range.

Regression on PHP8.6 branch.

getSymbol()/setSymbol() cast the zend_long to UNumberFormatSymbol before
range-checking it, so values like 2**32 wrapped into the valid range.
RETURN_FALSE;
}

UNumberFormatSymbol symbol = static_cast<UNumberFormatSymbol>(lsymbol);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can apply the same logic in numfmt_get_attribute and numfmt_set_attribute too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the fix. There are few missing value checks in this file as well, but it's not PHP 8.6 regression so I would just make in separate PR.

getAttribute()/setAttribute() switched on the value after casting it to
UNumberFormatAttribute, so values like 2**32 + MAX_FRACTION_DIGITS wrapped
into a valid attribute.
@jorgsowa jorgsowa closed this in 6eca1d0 Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants