[php-src] PHP-8.4: Fix argument number in sodium_crypto_stream_xchacha20_xor_ic() key length error (#25363)
| From: | Louis-Arnaud via GitHub | Date: | Tue, 10 Nov 2026 11:54:55 +0000 |
| Subject: | [php-src] PHP-8.4: Fix argument number in sodium_crypto_stream_xchacha20_xor_ic() key length error (#25363) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143525@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: TimWolla
Date: 2026-11-10T12:54:52+01:00
Commit: https://github.com/php/php-src/commit/8413eaa6c439f212589be0731fad95d552b8288d
Raw diff: https://github.com/php/php-src/commit/8413eaa6c439f212589be0731fad95d552b8288d.diff
Fix argument number in sodium_crypto_stream_xchacha20_xor_ic() key length error (#25363)
Changed paths:
M ext/sodium/libsodium.c
M ext/sodium/tests/crypto_stream_xchacha20.phpt
Diff:
diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c
index 57a34d5ec841..7c80de9cbf16 100644
--- a/ext/sodium/libsodium.c
+++ b/ext/sodium/libsodium.c
@@ -1391,7 +1391,7 @@ PHP_FUNCTION(sodium_crypto_stream_xchacha20_xor_ic)
RETURN_THROWS();
}
if (key_len != crypto_stream_xchacha20_KEYBYTES) {
- zend_argument_error(sodium_exception_ce, 3, "must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES
bytes long");
+ zend_argument_error(sodium_exception_ce, 4, "must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES
bytes long");
RETURN_THROWS();
}
ciphertext_len = msg_len;
diff --git a/ext/sodium/tests/crypto_stream_xchacha20.phpt
b/ext/sodium/tests/crypto_stream_xchacha20.phpt
index 466734853d70..08d81b0ed18b 100644
--- a/ext/sodium/tests/crypto_stream_xchacha20.phpt
+++ b/ext/sodium/tests/crypto_stream_xchacha20.phpt
@@ -75,6 +75,11 @@ try {
} catch (SodiumException $ex) {
echo $ex->getMessage(), "\n";
}
+try {
+ sodium_crypto_stream_xchacha20_xor_ic($stream, $nonce, 0, substr($key, 1));
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
+}
?>
--EXPECT--
@@ -94,3 +99,4 @@ sodium_crypto_stream_xchacha20(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STR
sodium_crypto_stream_xchacha20(): Argument #3 ($key) must be
SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long
sodium_crypto_stream_xchacha20_xor(): Argument #2 ($nonce) must be
SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long
sodium_crypto_stream_xchacha20_xor(): Argument #3 ($key) must be
SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long
+SodiumException: sodium_crypto_stream_xchacha20_xor_ic(): Argument #4 ($key) must be
SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long