Skip to content

[RFC] Random Extension 5.x + Random Extension Improvement #8094

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

Closed
wants to merge 1 commit into from

Conversation

zeriyoshi
Copy link
Contributor

@zeriyoshi zeriyoshi commented Feb 14, 2022

RFC: https://wiki.php.net/rfc/rng_extension
Additional RFC: https://wiki.php.net/rfc/random_extension_improvement
Internals Threads:

TODO

@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch 2 times, most recently from 7c67e8b to 8f9f004 Compare February 17, 2022 06:56
@TimWolla
Copy link
Member

TimWolla commented Feb 17, 2022

I've found one more issue: Serialization of MersenneTwister is not correct:

<?php

use Random\Engine\MersenneTwister;

$g1 = new MersenneTwister(1, MT_RAND_PHP);
$g2 = unserialize(serialize($g1));

for ($i = 0; $i < 10000; $i++) {
  if ($g1->generate() !== $g2->generate()) {
    var_dump($i);
    exit;
  }
}
echo "Success";

@zeriyoshi
Copy link
Contributor Author

I've found one more issue: Serialization of MersenneTwister is not correct:

<?php

use Random\Engine\MersenneTwister;

$g1 = new MersenneTwister(1, MT_RAND_PHP);
$g2 = unserialize(serialize($g1));

for ($i = 0; $i < 10000; $i++) {
  if ($g1->generate() !== $g2->generate()) {
    var_dump($i);
    exit;
  }
}
echo "Success";

fixed: 007b02c

@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch from 78e7da0 to 9e1f715 Compare February 18, 2022 08:58
@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch 3 times, most recently from ca32959 to d565273 Compare March 1, 2022 06:01
@zeriyoshi zeriyoshi changed the title [RFC] Random Extension 4.0 [RFC] Random Extension 5.x Mar 1, 2022
@cmb69 cmb69 added the RFC label Mar 8, 2022
@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch from af9c3ec to 34f20ea Compare March 9, 2022 07:35
@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch from aedf064 to d983a0b Compare April 26, 2022 07:43
@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch 3 times, most recently from 8f4220e to a470b7b Compare May 31, 2022 08:45
@zeriyoshi
Copy link
Contributor Author

@TimWolla
I have sent a pre-announcement of the start of the RFC voting to the Internals ML.
If you have any additional suggestions, I would be happy to reply to the email.

Sorry for the delay in responding. Thank you!

@cmb69
Copy link
Member

cmb69 commented Jul 15, 2022

Should the extension be listed in EXTENSIONS and have a CREDITS file to be listed in phpinfo?

Indeed, it should.

@zeriyoshi
Copy link
Contributor Author

@TimWolla @cmb69
In this case, who should I designate as the main maintainer? I am willing to do ongoing maintenance, but not the main committer currently.

@cmb69
Copy link
Member

cmb69 commented Jul 16, 2022

In this case, who should I designate as the main maintainer?

Don't spend too much time thinking about that. The info in that file is rather informal. Just add yourself as primary maintainer, and also @TimWolla if he wants that. That also doesn't mean that you are responsible for the extension; it's more like a hint that you may be the best person to reach out if there are any issues with that extension.

Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

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

Looks good to me for what it's worth.

@bukka
Copy link
Member

bukka commented Jul 16, 2022

@zeriyoshi Could you squash it please?

@TimWolla
Copy link
Member

TimWolla commented Jul 16, 2022

Just add yourself as primary maintainer, and also @TimWolla if he wants that.

@zeriyoshi @cmb69 Sure, feel free to list me as a co-maintainer (use either [email protected] or [email protected]). Significant parts of the design of the extension are based on my suggestions and I'll be happy at the very least to review future evaluations of the extension.

Copy link
Contributor

@guilliamxavier guilliamxavier left a comment

Choose a reason for hiding this comment

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

A couple nits

@bukka
Copy link
Member

bukka commented Jul 18, 2022

@zeriyoshi Just a reminder that the feature is in 24 hours and something so it would be good get it merged soon. Is there anything else that you want to do before merging? As I noted, the squashing that to a single commit or couple standalone commits if you prefer would be appreciated. I can handle the merging if no one else wants to do that.

@zeriyoshi
Copy link
Contributor Author

@zeriyoshi Just a reminder that the feature is in 24 hours and something so it would be good get it merged soon. Is there anything else that you want to do before merging? As I noted, the squashing that to a single commit or couple standalone commits if you prefer would be appreciated. I can handle the merging if no one else wants to do that.

@bukka
I will do this immediately.
I was working on a personal tasks, as some discussions had not been completed and existing bugs were causing CI to fail as well.
For the time being, I will squash it through CI. Please wait.

@zeriyoshi zeriyoshi force-pushed the upstream_rfc/scoped_rng_for_pr branch from 33679c6 to 2e6b742 Compare July 19, 2022 03:20
@zeriyoshi
Copy link
Contributor Author

@bukka @TimWolla @cmb69 @bwoebi @kocsismate @guilliamxavier

All commits are combined into one. However, some records of the parts that were suggestion have been lost along the way. However, I think this is not a problem because we can refer to it on the pull request. What do you think?

Also, I have worked around the Assertion Failed problem on Windows by adding a workaround. This is already a separate issue and should be addressed separately.

As far as I can see, this PR is already ready to merge. What do you think?

I will create a follow-up MR as soon as this is merged to fix the issues mentioned in the PR and ML.

@zeriyoshi
Copy link
Contributor Author

P.S. Branches before being squashed can be found at: https://github.com/colopl/php-src/tree/upstream_rfc/scoped_rng_backup

@zeriyoshi
Copy link
Contributor Author

CI passed 😎

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

Tests are unmodified and I eyeballed the newest changes, this still LGTM and IMO is ready to merge.

@TimWolla
Copy link
Member

@bukka Will you handle the merge, please? 😃

@bukka
Copy link
Member

bukka commented Jul 19, 2022

This has been merged via 4d8dd8d - just moved some bits from NEWS to UPGRADING otherwise it was perfectly ready. Thanks! Great work!

END_EXTERN_C()

#endif
#include "ext/random/php_random.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I just noticed: here was introduced a Git warning "No newline at end of file"

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.

7 participants