mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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
This commit is contained in:
parent
5d5d9796fc
commit
c63f18dd9b
3 changed files with 14 additions and 14 deletions
|
@ -282,14 +282,14 @@ PHP_METHOD(Random_Randomizer, __unserialize)
|
|||
|
||||
members_zv = zend_hash_index_find(d, 0);
|
||||
if (!members_zv || Z_TYPE_P(members_zv) != IS_ARRAY) {
|
||||
zend_throw_exception(NULL, "Incomplete or ill-formed serialization data", 0);
|
||||
zend_throw_exception(NULL, "Invalid serialization data for Random\\Randomizer object", 0);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
object_properties_load(&randomizer->std, Z_ARRVAL_P(members_zv));
|
||||
|
||||
zengine = zend_read_property(randomizer->std.ce, &randomizer->std, "engine", strlen("engine"), 0, NULL);
|
||||
zengine = zend_read_property(randomizer->std.ce, &randomizer->std, "engine", strlen("engine"), 1, NULL);
|
||||
if (Z_TYPE_P(zengine) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(zengine), random_ce_Random_Engine)) {
|
||||
zend_throw_exception(NULL, "Incomplete or ill-formed serialization data", 0);
|
||||
zend_throw_exception(NULL, "Invalid serialization data for Random\\Randomizer object", 0);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue