Skip to content

Commit 31d221f

Browse files
committed
Revert "ext/sodium: throw exceptions instead of errors"
This reverts commit c05cbd1.
1 parent 0b30461 commit 31d221f

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

ext/sodium/libsodium.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,13 +1853,11 @@ PHP_FUNCTION(sodium_crypto_pwhash)
18531853
return;
18541854
}
18551855
if (opslimit < crypto_pwhash_OPSLIMIT_MIN) {
1856-
zend_throw_exception(sodium_exception_ce,
1857-
"number of operations for the password hashing function is too low", 0);
1858-
return;
1856+
zend_error(E_ERROR,
1857+
"number of operations for the password hashing function is too low");
18591858
}
18601859
if (memlimit < crypto_pwhash_MEMLIMIT_MIN) {
1861-
zend_throw_exception(sodium_exception_ce,
1862-
"maximum memory for the password hashing function is too low", 0);
1860+
zend_error(E_ERROR, "maximum memory for the password hashing function is too low");
18631861
}
18641862
hash = zend_string_alloc((size_t) hash_len, 0);
18651863
ret = -1;
@@ -1918,12 +1916,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_str)
19181916
zend_error(E_WARNING, "empty password");
19191917
}
19201918
if (opslimit < crypto_pwhash_OPSLIMIT_MIN) {
1921-
zend_throw_exception(sodium_exception_ce,
1922-
"number of operations for the password hashing function is too low", 0);
1919+
zend_error(E_ERROR,
1920+
"number of operations for the password hashing function is too low");
19231921
}
19241922
if (memlimit < crypto_pwhash_MEMLIMIT_MIN) {
1925-
zend_throw_exception(sodium_exception_ce,
1926-
"maximum memory for the password hashing function is too low", 0);
1923+
zend_error(E_ERROR,
1924+
"maximum memory for the password hashing function is too low");
19271925
}
19281926
hash_str = zend_string_alloc(crypto_pwhash_STRBYTES - 1, 0);
19291927
if (crypto_pwhash_str
@@ -2032,12 +2030,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256)
20322030
return;
20332031
}
20342032
if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) {
2035-
zend_throw_exception(sodium_exception_ce,
2036-
"number of operations for the scrypt function is too low", 0);
2033+
zend_error(E_ERROR,
2034+
"number of operations for the scrypt function is too low");
20372035
}
20382036
if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) {
2039-
zend_throw_exception(sodium_exception_ce,
2040-
"maximum memory for the scrypt function is too low", 0);
2037+
zend_error(E_ERROR,
2038+
"maximum memory for the scrypt function is too low");
20412039
}
20422040
hash = zend_string_alloc((size_t) hash_len, 0);
20432041
if (crypto_pwhash_scryptsalsa208sha256
@@ -2079,12 +2077,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str)
20792077
zend_error(E_WARNING, "empty password");
20802078
}
20812079
if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) {
2082-
zend_throw_exception(sodium_exception_ce,
2083-
"number of operations for the scrypt function is too low", 0);
2080+
zend_error(E_ERROR,
2081+
"number of operations for the scrypt function is too low");
20842082
}
20852083
if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) {
2086-
zend_throw_exception(sodium_exception_ce,
2087-
"maximum memory for the scrypt function is too low", 0);
2084+
zend_error(E_ERROR,
2085+
"maximum memory for the scrypt function is too low");
20882086
}
20892087
hash_str = zend_string_alloc
20902088
(crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1, 0);

0 commit comments

Comments
 (0)