xref: /PHP-8.2/ext/hash/tests/bug52240.phpt (revision f73c0102)
1--TEST--
2Bug #52240 (hash_copy() does not copy the HMAC key, causes wrong results and PHP crashes)
3--FILE--
4<?php
5
6$h = hash_init('md5', HASH_HMAC, '123456');
7$h2 = hash_copy($h);
8var_dump(hash_final($h));
9$h3 = hash_copy($h2);
10var_dump(hash_final($h2));
11var_dump(hash_final($h3));
12
13?>
14--EXPECT--
15string(32) "cab1380ea86d8acc9aa62390a58406aa"
16string(32) "cab1380ea86d8acc9aa62390a58406aa"
17string(32) "cab1380ea86d8acc9aa62390a58406aa"
18