xref: /PHP-8.4/ext/sysvshm/tests/gh16591.phpt (revision 992ac1c2)
1--TEST--
2GH-16591 (Assertion error in shm_put_var)
3--EXTENSIONS--
4sysvshm
5--FILE--
6<?php
7
8class C {
9    function __serialize(): array {
10        global $mem;
11        shm_detach($mem);
12        return ['a' => 'b'];
13    }
14}
15
16$mem = shm_attach(1);
17try {
18    shm_put_var($mem, 1, new C);
19} catch (Error $e) {
20    echo $e->getMessage(), "\n";
21}
22
23?>
24--EXPECT--
25Shared memory block has been destroyed by the serialization function
26