xref: /PHP-5.6/ext/hash/tests/hash_equals.phpt (revision 2148a88b)
1--TEST--
2hash_equals() function
3--FILE--
4<?php
5var_dump(hash_equals("same", "same"));
6var_dump(hash_equals("not1same", "not2same"));
7var_dump(hash_equals("short", "longer"));
8var_dump(hash_equals("longer", "short"));
9var_dump(hash_equals("", "notempty"));
10var_dump(hash_equals("notempty", ""));
11var_dump(hash_equals("", ""));
12var_dump(hash_equals(123, "NaN"));
13var_dump(hash_equals("NaN", 123));
14var_dump(hash_equals(123, 123));
15var_dump(hash_equals(null, ""));
16var_dump(hash_equals(null, 123));
17var_dump(hash_equals(null, null));
18--EXPECTF--
19bool(true)
20bool(false)
21bool(false)
22bool(false)
23bool(false)
24bool(false)
25bool(true)
26
27Warning: hash_equals(): Expected known_string to be a string, integer given in %s on line %d
28bool(false)
29
30Warning: hash_equals(): Expected user_string to be a string, integer given in %s on line %d
31bool(false)
32
33Warning: hash_equals(): Expected known_string to be a string, integer given in %s on line %d
34bool(false)
35
36Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
37bool(false)
38
39Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
40bool(false)
41
42Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
43bool(false)
44