From: Frank Denis Date: Tue, 28 Nov 2017 22:30:21 +0000 (+0100) Subject: Revert "ext/sodium: throw exceptions instead of errors" X-Git-Tag: php-7.2.1RC1~29^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31d221f9c72f0d0322c84907c5d89a4464667244;p=php Revert "ext/sodium: throw exceptions instead of errors" This reverts commit c05cbd1e775fa69ed9939796a908390f2bfb4459. --- diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c index a9cb17d772..f08a272e04 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -1853,13 +1853,11 @@ PHP_FUNCTION(sodium_crypto_pwhash) return; } if (opslimit < crypto_pwhash_OPSLIMIT_MIN) { - zend_throw_exception(sodium_exception_ce, - "number of operations for the password hashing function is too low", 0); - return; + zend_error(E_ERROR, + "number of operations for the password hashing function is too low"); } if (memlimit < crypto_pwhash_MEMLIMIT_MIN) { - zend_throw_exception(sodium_exception_ce, - "maximum memory for the password hashing function is too low", 0); + zend_error(E_ERROR, "maximum memory for the password hashing function is too low"); } hash = zend_string_alloc((size_t) hash_len, 0); ret = -1; @@ -1918,12 +1916,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_str) zend_error(E_WARNING, "empty password"); } if (opslimit < crypto_pwhash_OPSLIMIT_MIN) { - zend_throw_exception(sodium_exception_ce, - "number of operations for the password hashing function is too low", 0); + zend_error(E_ERROR, + "number of operations for the password hashing function is too low"); } if (memlimit < crypto_pwhash_MEMLIMIT_MIN) { - zend_throw_exception(sodium_exception_ce, - "maximum memory for the password hashing function is too low", 0); + zend_error(E_ERROR, + "maximum memory for the password hashing function is too low"); } hash_str = zend_string_alloc(crypto_pwhash_STRBYTES - 1, 0); if (crypto_pwhash_str @@ -2032,12 +2030,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256) return; } if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) { - zend_throw_exception(sodium_exception_ce, - "number of operations for the scrypt function is too low", 0); + zend_error(E_ERROR, + "number of operations for the scrypt function is too low"); } if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) { - zend_throw_exception(sodium_exception_ce, - "maximum memory for the scrypt function is too low", 0); + zend_error(E_ERROR, + "maximum memory for the scrypt function is too low"); } hash = zend_string_alloc((size_t) hash_len, 0); if (crypto_pwhash_scryptsalsa208sha256 @@ -2079,12 +2077,12 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str) zend_error(E_WARNING, "empty password"); } if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) { - zend_throw_exception(sodium_exception_ce, - "number of operations for the scrypt function is too low", 0); + zend_error(E_ERROR, + "number of operations for the scrypt function is too low"); } if (memlimit < crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) { - zend_throw_exception(sodium_exception_ce, - "maximum memory for the scrypt function is too low", 0); + zend_error(E_ERROR, + "maximum memory for the scrypt function is too low"); } hash_str = zend_string_alloc (crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1, 0);