]> granicus.if.org Git - php/commitdiff
Revert "ext/sodium: throw exceptions instead of errors"
authorFrank Denis <github@pureftpd.org>
Tue, 28 Nov 2017 22:30:21 +0000 (23:30 +0100)
committerFrank Denis <github@pureftpd.org>
Tue, 28 Nov 2017 22:30:21 +0000 (23:30 +0100)
This reverts commit c05cbd1e775fa69ed9939796a908390f2bfb4459.

ext/sodium/libsodium.c

index a9cb17d772989d53bb214c9449b68ce1a70895e1..f08a272e0456c8cae71819c87ed1a06a6e0baa2d 100644 (file)
@@ -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);