xref: /PHP-7.0/ext/hash/tests/bug52240.phpt (revision 0891e86e)
1--TEST--
2Bug #52240 (hash_copy() does not copy the HMAC key, causes wrong results and PHP crashes)
3--SKIPIF--
4<?php extension_loaded('hash') or die('skip'); ?>
5--FILE--
6<?php
7
8$h = hash_init('crc32b', HASH_HMAC, '123456' );
9$h2 = hash_copy($h);
10var_dump(hash_final($h));
11$h3 = hash_copy($h2);
12var_dump(hash_final($h2));
13var_dump(hash_final($h3));
14
15?>
16--EXPECT--
17string(8) "278af264"
18string(8) "278af264"
19string(8) "278af264"
20