mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
We must not allow to serialize already finalized `HashContext`s, since the internal context is already freed. Since there is not much point in serializing finalized `HashContext`s, we just bail out in that case. Closes GH-8265.
15 lines
291 B
PHP
15 lines
291 B
PHP
--TEST--
|
|
Bug #81714 (segfault when serializing finalized HashContext)
|
|
--FILE--
|
|
<?php
|
|
$h = hash_init('md5');
|
|
hash_final($h);
|
|
try {
|
|
serialize($h);
|
|
} catch (Exception $ex) {
|
|
var_dump($ex->getMessage());
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
string(52) "HashContext for algorithm "md5" cannot be serialized"
|