Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Clean up nested exceptions without value-add in ext/random#9211

Merged
TimWolla merged 7 commits into
php:masterphp/php-src:masterfrom
TimWolla:random-exception-cleanup2TimWolla/php-src:random-exception-cleanup2Copy head branch name to clipboard
Aug 2, 2022
Merged

Clean up nested exceptions without value-add in ext/random#9211
TimWolla merged 7 commits into
php:masterphp/php-src:masterfrom
TimWolla:random-exception-cleanup2TimWolla/php-src:random-exception-cleanup2Copy head branch name to clipboard

Conversation

@TimWolla

Copy link
Copy Markdown
Member

No description provided.

The only way that `php_binary_string_shuffle` fails is when the engine itself
fails. With the currently available list of engines we have:

- Mt19937            : Infallible.
- PcgOneseq128XslRr64: Infallible.
- Xoshiro256StarStar : Infallible.
- Secure             : Practically infallible on modern systems.
                       Exception messages were cleaned up in phpGH-9169.
- User               : Error when returning an empty string.
                       Error when seriously biased (range() fails).
                       And whatever Throwable the userland developer decides to use.

So the existing engines are either infallible or throw an Exception/Error with
a high quality message themselves, making this exception not a value-add and
possibly confusing.
Same reasoning as in the previous commit applies.
Same reasoning as in the previous commit applies.
Same reasoning as in the previous commit applies, except that it won't throw on
a seriously biased user engine, as `range()` is not used.
Same reasoning as in the previous commit applies.
This implementation is shared across all native engines. Thus the same
reasoning as the previous commits applies, except that the User engine does not
use this method. Thus is only applicable to the Secure engine, which is the
only fallible native engine.
@TimWolla TimWolla force-pushed the random-exception-cleanup2 branch from be46f79 to 1b39d5e Compare August 1, 2022 17:14
@TimWolla TimWolla requested review from Girgias and cmb69 August 1, 2022 18:12
@TimWolla

TimWolla commented Aug 1, 2022

Copy link
Copy Markdown
Member Author

Note: I'm currently working on a second PR that compliments this one and that adds a proper hierarchy for the remaining Exceptions (which are all useful on their own).

@cmb69 cmb69 left a comment

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.

LGTM. Thank you!

@TimWolla TimWolla merged commit 54e406c into php:master Aug 2, 2022
TimWolla added a commit that referenced this pull request Aug 2, 2022
…eta 3

Didn't realize that Beta 2 was tagged before merging GH-9211 /
54e406c.
@TimWolla TimWolla deleted the random-exception-cleanup2 branch August 30, 2022 20:33
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.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.