summaryrefslogtreecommitdiff
path: root/ext/sodium/tests/sodium_error_001.phpt
blob: 094500c4958692172109aa1b6c6af518db7ca74d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
TypeErrors will not contain param values in backtrace
--SKIPIF--
<?php if (!extension_loaded("sodium")) die("skip ext/sodium required"); ?>
--FILE--
<?php
declare(strict_types=1);

function do_crypto_shorthash($message, $key) {
  return sodium_crypto_shorthash($message, $key);
}

$m = 12;
$key = random_bytes(SODIUM_CRYPTO_SHORTHASH_KEYBYTES);
$hash = do_crypto_shorthash($m, $key);
?>
--EXPECTF--
Fatal error: Uncaught TypeError: sodium_crypto_shorthash() expects parameter 1 to be string, integer given in %s:%d
Stack trace:
#0 %s(%d): sodium_crypto_shorthash()
#1 %s(%d): do_crypto_shorthash()
#2 {main}
  thrown in %s on line %d