Commit graph

13 commits

Author SHA1 Message Date
Tim Düsterhus
6b1d0606d0
Merge branch 'PHP-8.3'
* PHP-8.3:
  random: Add additional test for Randomizer::getFloat() (#12436)
2023-10-14 18:38:43 +02:00
Tim Düsterhus
ac0b9bff97
random: Add additional test for Randomizer::getFloat() (#12436) 2023-10-14 18:38:11 +02:00
divinity76
ab30f27ce3
random: Perform fewer iterations if SKIP_SLOW_TESTS is set (#12279)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2023-09-23 14:48:33 +02:00
Tim Düsterhus
ddf7a5d4d9
random: Validate that the arrays do not contain extra elements when unserializing (#9458)
* Apply `var_dump()` in 02_engine/all_serialize_error.phpt

This ensures that an undetected serialization error is clear identifiable in the output.

* random: Validate that the arrays do not contain extra elements when unserializing
2022-09-05 17:33:36 +02:00
Tim Düsterhus
f7d426cca6
Unify structure for ext/random's randomizer tests (#9410)
* Unify structure for ext/random's engine tests (2)

This makes adjustments that were missed in
2d6a883b3a.

* Add `engines.inc` for ext/random tests

* Unify structure for ext/random's randomizer tests
2022-08-31 19:22:39 +02:00
Tim Düsterhus
2d6a883b3a
Unify structure for ext/random's engine tests (#9321)
* Remove user_xoshiro128plusplus.phpt

This test does not exercise any of the code paths of the random extension and
thus is no value-add.

* Unify structure for ext/random's engine tests
2022-08-23 23:55:11 +02:00
Tim Düsterhus
1cd2d731ef
Handle all-zero state in Xoshiro256** (#9250)
- Retry if the CSPRNG generates a zero state.
- Throw ValueError if the user passes a zero state.

Fixes GH-9249
2022-08-05 14:38:57 +02:00
Tim Düsterhus
a191710a21
[ci skip] Run dos2unix on ext/random tests
One test inconsistently had CRLF newlines.
2022-08-04 21:01:04 +02:00
Tim Düsterhus
c63f18dd9b
Unify ext/random unserialize errors with ext/date (#9185)
* Unify ext/random unserialize errors with ext/date

- Use `Error` instead of `Exception`.
- Adjust wording.

* Make `zend_read_property` silent in `Randomizer::__unserialize()`

Having:

> Error: Typed property Random\Randomizer::$engine must not be accessed before
> initialization

is not a value-add in this case.

* Insert the actual class name in the unserialization error of Engines

* Revert unserialization failure back to Exception from Error

see https://news-web.php.net/php.internals/118311
2022-08-02 09:00:37 +02:00
Anton Smirnov
50bd8ba51c
PcgOneseq128XslRr64::jump(): Throw ValueError for negative $advance (#9213)
* PCG64: $advance must be non-negative

Closes GH-9212
2022-08-01 13:47:14 +01:00
Tim Düsterhus
53ca24d46e
Improve phrasing in argument value errors in ext/random (#9206)
This rephrases the error message for argument errors to be a proper English
sentence.

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
2022-07-31 19:27:28 +02:00
Tim Düsterhus
d058acb4ac
Use ValueError if an invalid mode is passed to Mt19937 (#9159) 2022-07-27 09:03:02 +02:00
Go Kudo
4d8dd8d258
Implement Random Extension
https://wiki.php.net/rfc/rng_extension
https://wiki.php.net/rfc/random_extension_improvement
2022-07-19 10:27:38 +01:00