-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Random Extension 5.x follow-up #9052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…xtInt() Since argument overloading is not safe for reflection, the method needed to be split appropriately.
Thanks. I've already picked the first comment for the change to EXTENSIONS into d43e55b, because that one definitely is good, whereas the rest will need some discussion. |
// nextInt | ||
for ($i = 0; $i < 1000; $i++) { | ||
try { | ||
if (!\is_int($randomizer->nextInt())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result cannot be not int due to the return type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in new PR: #9057
@zeriyoshi One request for the future: Can you split unrelated changes into separate PRs? In this case: One for the EXTENSIONS file (which I already merged), one for the headers and one for getInt/nextInt. That makes it easier to independently review and merge them. |
@TimWolla |
Since it is complicated, I would like to close this PR and create a new PR. |
@TimWolla @kocsismate |
This caused two UBSAN failures: https://github.com/php/php-src/runs/7420828169?check_suite_focus=true
@zeriyoshi Could you have a look? Thanks! |
@iluuu1994 |
The Random Extension 5.x and Random Extension Improvement proposals passed, but with the problem of argument overloading.
#8094
As noted by some, argument overloading is now discouraged and should not be implemented anew.
This changes separates the argumentless
Random\Randomizer::getInt()
intoRandom\Randomizer::nextInt()
.At the same time, compatibility header files for internal APIs were removed.
This may affect downstream extensions, but can be easily circumvented by macro-branching with
PHP_VERSION_ID
.