Repository navigation
Limit decimals and shorten rejected input in exception messages on 8.2.x - #18
Merged
Merged
Conversation
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.
Summary
Fixes the two findings from the security review for the
8.2.xline:$decimalshad no upper bound, and exception messages repeated the rejected input in full.Changes
$decimalsabove 100 throwsInvalidArgumentExceptioninNumber::format(),Number::compact(),Number::percentage(),Bytes::format(),Money::format()andMoney::compact(). Very large values used to exhaust memory with an uncatchable fatal error (Number::format(1.5, PHP_INT_MAX)) or return wrong digits: with a locale,Number::format(1.5, 100000000, false, 'en_US')returned"0".Support\Excerpthelper. This coversBytes::parse(),Duration::between(), currency codes, invalid locales andMissingIntlExtension. A 1 MB input now gives a message under 100 bytes.PHP_INT_MAX), short and cut messages, multibyte cutting, and the locale and missing-intl paths.MAINTAINING.mdand a8.2.2 - Unreleasedchangelog section describe the limit.Compatibility
Decimals from 0 to 100 format exactly as before. Values above 100 used to crash or print wrong numbers, so rejecting them is a bug fix. Exception message text changed only for inputs longer than 50 bytes.