sodium: fix return-value prose for 4 functions that throw SodiumException instead of returning false#5655
Merged
Conversation
…row SodiumException instead of returning false
Member
|
It's good IDE's have autocomplete these days. Anyway back on topic. The stubs don't allow the function to return false anyway. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The return values section of these four functions states they return
falseon failure. In php-src they never returnfalse: every error path throws aSodiumException(zend_throw_exception/zend_argument_errorfollowed byRETURN_THROWS()), and on success the function returns the raw binary string.Proof in
ext/sodium/libsodium.c(pinned at1a7f3c0), none of the four bodies contains aRETURN_FALSE:sodium_crypto_aead_chacha20poly1305_encrypt: L2123-L2177, throws at L2143sodium_crypto_aead_chacha20poly1305_ietf_encrypt: L2236-L2294, throws at L2256sodium_crypto_aead_xchacha20poly1305_ietf_encrypt: L2359-L2413, throws at L2379sodium_crypto_stream_xchacha20_xor_ic: L1364-L1405, throws at L1383