Skip to content

Commit bcb0e0a

Browse files
committed
Use zend_value_error.
1 parent eefdda6 commit bcb0e0a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/hash/hash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ PHP_METHOD(HashContext, __serialize)
14231423
return;
14241424

14251425
serialize_failure:
1426-
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "HashContext for algorithm '%s' cannot be serialized", hash->ops->algo);
1426+
zend_value_error("HashContext for algorithm '%s' cannot be serialized", hash->ops->algo);
14271427
RETURN_THROWS();
14281428
}
14291429
/* }}} */
@@ -1461,7 +1461,7 @@ PHP_METHOD(HashContext, __unserialize)
14611461
|| !options_zv || Z_TYPE_P(options_zv) != IS_LONG
14621462
|| !hash_zv
14631463
|| !members_zv || Z_TYPE_P(members_zv) != IS_ARRAY) {
1464-
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Incomplete or ill-formed serialization data");
1464+
zend_value_error("Incomplete or ill-formed serialization data");
14651465
RETURN_THROWS();
14661466
}
14671467

@@ -1470,15 +1470,15 @@ PHP_METHOD(HashContext, __unserialize)
14701470

14711471
ops = php_hash_fetch_ops(Z_STR_P(algo_zv));
14721472
if (!ops) {
1473-
zend_throw_exception(spl_ce_UnexpectedValueException, "Unknown hash algorithm", 0);
1473+
zend_value_error("Unknown hash algorithm");
14741474
RETURN_THROWS();
14751475
} else if (!ops->hash_unserialize) {
1476-
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Hash algorithm '%s' cannot be unserialized", ops->algo);
1476+
zend_value_error("Hash algorithm '%s' cannot be unserialized", ops->algo);
14771477
RETURN_THROWS();
14781478
} else if ((options & PHP_HASH_HMAC)
14791479
&& (!key_zv || Z_TYPE_P(key_zv) != IS_STRING
14801480
|| Z_STRLEN_P(key_zv) != ops->block_size)) {
1481-
zend_throw_exception(spl_ce_UnexpectedValueException, "Incomplete or ill-formed serialization data", 0);
1481+
zend_value_error("Incomplete or ill-formed serialization data");
14821482
RETURN_THROWS();
14831483
}
14841484

@@ -1488,7 +1488,7 @@ PHP_METHOD(HashContext, __unserialize)
14881488
hash->options = zval_get_long(options_zv);
14891489

14901490
if (ops->hash_unserialize(hash, magic, hash_zv) != SUCCESS) {
1491-
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "HashContext for algorithm '%s' cannot be unserialized, format may be non-portable", ops->algo);
1491+
zend_value_error("HashContext for algorithm '%s' cannot be unserialized, format may be non-portable", ops->algo);
14921492
RETURN_THROWS();
14931493
}
14941494

0 commit comments

Comments
 (0)