xref: /PHP-7.4/ext/sysvshm/tests/003.phpt (revision 26dfce7f)
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
13var_dump(shm_detach());
14var_dump(shm_detach(1,1));
15
16$s = shm_attach($key);
17
18var_dump(shm_detach($s));
19var_dump(shm_detach($s));
20shm_remove($s);
21
22var_dump(shm_detach(0));
23var_dump(shm_detach(1));
24var_dump(shm_detach(-1));
25
26echo "Done\n";
27?>
28--CLEAN--
29<?php
30
31$key = ftok(__DIR__."/003.phpt", 'q');
32$s = shm_attach($key);
33shm_remove($s);
34
35?>
36--EXPECTF--
37Warning: shm_detach() expects exactly 1 parameter, 0 given in %s003.php on line %d
38NULL
39
40Warning: shm_detach() expects exactly 1 parameter, 2 given in %s003.php on line %d
41NULL
42bool(true)
43
44Warning: shm_detach(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
45bool(false)
46
47Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
48
49Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
50NULL
51
52Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
53NULL
54
55Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
56NULL
57Done
58