Skip to content

random: Remove RAND_RANGE_BADSCALING - #12374

Merged
Girgias merged 2 commits into
php:masterfrom
TimWolla:rand-range-badscaling
Oct 7, 2023
Merged

Girgias merged 2 commits into
php:masterfrom
TimWolla:rand-range-badscaling

Conversation

@TimWolla

@TimWolla TimWolla commented Oct 6, 2023

Copy link
Copy Markdown
Member

This macro is no longer used within php-src since
60ace13, it invokes undefined behavior depending on the input and the corresponding MT_RAND_PHP mode was deprecated in PHP 8.3.

Thus remove this macro. Any remaining non-php-src user should just inline it into their code, but should ideally migrate to a non-biased scaler. In any case the undefined behavior of the original implementation should be accounted for.

This macro is no longer used within php-src since
60ace13, it invokes undefined behavior
depending on the input and the corresponding MT_RAND_PHP mode was deprecated in
PHP 8.3.

Thus remove this macro. Any remaining non-php-src user should just inline it
into their code, but should ideally migrate to a non-biased scaler. In any case
the undefined behavior of the original implementation should be accounted for.

@Girgias Girgias 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.

UPGRADING.INTERNALS entry is probably needed.

@TimWolla

TimWolla commented Oct 6, 2023

Copy link
Copy Markdown
Member Author

UPGRADING.INTERNALS entry is probably needed.

Makes sense, done.

@Girgias
Girgias merged commit 3bc63a3 into php:master Oct 7, 2023
@TimWolla
TimWolla deleted the rand-range-badscaling branch October 7, 2023 14:47
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