diff --git a/ext/random/engine_mt19937.c b/ext/random/engine_mt19937.c index 760d0df90363b..1c89a34d92e85 100644 --- a/ext/random/engine_mt19937.c +++ b/ext/random/engine_mt19937.c @@ -279,8 +279,8 @@ PHP_METHOD(Random_Engine_Mt19937, __construct) if (seed_is_null) { /* MT19937 has a very large state, uses CSPRNG for seeding only */ - if (php_random_bytes_silent(&seed, sizeof(zend_long)) == FAILURE) { - zend_throw_exception(spl_ce_RuntimeException, "Random number generation failed", 0); + if (php_random_bytes_throw(&seed, sizeof(zend_long)) == FAILURE) { + zend_throw_exception(spl_ce_RuntimeException, "Failed to generate a random seed", 0); RETURN_THROWS(); } } diff --git a/ext/random/engine_pcgoneseq128xslrr64.c b/ext/random/engine_pcgoneseq128xslrr64.c index 7f15c839d3372..19030a7c12360 100644 --- a/ext/random/engine_pcgoneseq128xslrr64.c +++ b/ext/random/engine_pcgoneseq128xslrr64.c @@ -148,8 +148,8 @@ PHP_METHOD(Random_Engine_PcgOneseq128XslRr64, __construct) ZEND_PARSE_PARAMETERS_END(); if (seed_is_null) { - if (php_random_bytes_silent(&state->state, sizeof(php_random_uint128_t)) == FAILURE) { - zend_throw_exception(spl_ce_RuntimeException, "Random number generation failed", 0); + if (php_random_bytes_throw(&state->state, sizeof(php_random_uint128_t)) == FAILURE) { + zend_throw_exception(spl_ce_RuntimeException, "Failed to generate a random seed", 0); RETURN_THROWS(); } } else { diff --git a/ext/random/engine_xoshiro256starstar.c b/ext/random/engine_xoshiro256starstar.c index 502fc59e4e02a..4d81239807563 100644 --- a/ext/random/engine_xoshiro256starstar.c +++ b/ext/random/engine_xoshiro256starstar.c @@ -206,8 +206,8 @@ PHP_METHOD(Random_Engine_Xoshiro256StarStar, __construct) ZEND_PARSE_PARAMETERS_END(); if (seed_is_null) { - if (php_random_bytes_silent(&state->state, 32) == FAILURE) { - zend_throw_exception(spl_ce_RuntimeException, "Random number generation failed", 0); + if (php_random_bytes_throw(&state->state, 32) == FAILURE) { + zend_throw_exception(spl_ce_RuntimeException, "Failed to generate a random seed", 0); RETURN_THROWS(); } } else {