1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Files
archived-php-src/ext/hash/tests/hash_equals.phpt
T
Gabriel Caruso ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00

47 lines
1.3 KiB
PHP

--TEST--
hash_equals() function
--SKIPIF--
<?php if(!extension_loaded('hash')) die('skip hash extension not loaded'); ?>
--FILE--
<?php
var_dump(hash_equals("same", "same"));
var_dump(hash_equals("not1same", "not2same"));
var_dump(hash_equals("short", "longer"));
var_dump(hash_equals("longer", "short"));
var_dump(hash_equals("", "notempty"));
var_dump(hash_equals("notempty", ""));
var_dump(hash_equals("", ""));
var_dump(hash_equals(123, "NaN"));
var_dump(hash_equals("NaN", 123));
var_dump(hash_equals(123, 123));
var_dump(hash_equals(null, ""));
var_dump(hash_equals(null, 123));
var_dump(hash_equals(null, null));
?>
--EXPECTF--
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(true)
Warning: hash_equals(): Expected known_string to be a string, int given in %s on line %d
bool(false)
Warning: hash_equals(): Expected user_string to be a string, int given in %s on line %d
bool(false)
Warning: hash_equals(): Expected known_string to be a string, int given in %s on line %d
bool(false)
Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
bool(false)
Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
bool(false)
Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
bool(false)