xref: /PHP-8.0/ext/sysvshm/tests/003.phpt (revision 2e18b30d)
1--TEST--
2shm_detach() tests
3--SKIPIF--
4<?php
5if (!extension_loaded("sysvshm")){ print 'skip'; }
6if (!function_exists('ftok')){ print 'skip'; }
7?>
8--FILE--
9<?php
10
11$key = ftok(__DIR__."/003.phpt", 'q');
12
13$s = shm_attach($key);
14
15var_dump(shm_detach($s));
16try {
17    shm_detach($s);
18} catch (Error $exception) {
19    echo $exception->getMessage() . "\n";
20}
21
22try {
23    shm_remove($s);
24} catch (Error $exception) {
25    echo $exception->getMessage() . "\n";
26}
27
28echo "Done\n";
29?>
30--CLEAN--
31<?php
32
33$key = ftok(__DIR__."/003.phpt", 'q');
34$s = shm_attach($key);
35shm_remove($s);
36
37?>
38--EXPECT--
39bool(true)
40Shared memory block has already been destroyed
41Shared memory block has already been destroyed
42Done
43