Skip to content

sodium: fix return-value prose for 4 functions that throw SodiumException instead of returning false#5655

Merged
jordikroon merged 1 commit into
php:masterfrom
lacatoire:sync-src/sodium-fixes
Jul 9, 2026
Merged

sodium: fix return-value prose for 4 functions that throw SodiumException instead of returning false#5655
jordikroon merged 1 commit into
php:masterfrom
lacatoire:sync-src/sodium-fixes

Conversation

@lacatoire

@lacatoire lacatoire commented Jul 6, 2026

Copy link
Copy Markdown
Member

The return values section of these four functions states they return false on failure. In php-src they never return false: every error path throws a SodiumException (zend_throw_exception / zend_argument_error followed by RETURN_THROWS()), and on success the function returns the raw binary string.

Proof in ext/sodium/libsodium.c (pinned at 1a7f3c0), none of the four bodies contains a RETURN_FALSE:

…row SodiumException instead of returning false
@jordikroon

Copy link
Copy Markdown
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.

@jordikroon
jordikroon merged commit cc7976f into php:master Jul 9, 2026
2 checks passed
@lacatoire
lacatoire deleted the sync-src/sodium-fixes branch July 9, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants