mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Replace RuntimeException in Randomizer::nextInt() by RandomException (#9305)
* Replace RuntimeException in Randomizer::nextInt() by RandomException * Add ext/random/tests/03_randomizer/nextint_error.phpt
This commit is contained in:
parent
4b7a98754d
commit
3b48a2044d
4 changed files with 22 additions and 5 deletions
|
@ -24,7 +24,6 @@
|
|||
#include "ext/standard/php_array.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
|
||||
#include "ext/spl/spl_exceptions.h"
|
||||
#include "Zend/zend_exceptions.h"
|
||||
|
||||
static inline void randomizer_common_init(php_random_randomizer *randomizer, zend_object *engine_object) {
|
||||
|
@ -102,7 +101,7 @@ PHP_METHOD(Random_Randomizer, nextInt)
|
|||
RETURN_THROWS();
|
||||
}
|
||||
if (randomizer->status->last_generated_size > sizeof(zend_long)) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Generated value exceeds size of int", 0);
|
||||
zend_throw_exception(random_ce_Random_RandomException, "Generated value exceeds size of int", 0);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue