xref: /PHP-7.3/ext/sysvshm/tests/006.phpt (revision b746e698)
1--TEST--
2shm_remove_var() 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(__FILE__, 't');
12$s = shm_attach($key, 1024);
13
14shm_put_var($s, 1, "test string");
15
16var_dump(shm_remove_var());
17var_dump(shm_remove_var(-1, -1));
18var_dump(shm_remove_var($s, -10));
19
20var_dump(shm_get_var($s, 1));
21
22var_dump(shm_remove_var($s, 1));
23var_dump(shm_get_var($s, 1));
24
25var_dump(shm_remove_var($s, 1));
26var_dump(shm_get_var($s, 1));
27
28shm_remove($s);
29echo "Done\n";
30?>
31--EXPECTF--
32Warning: shm_remove_var() expects exactly 2 parameters, 0 given in %s006.php on line %d
33NULL
34
35Warning: shm_remove_var() expects parameter 1 to be resource, int given in %s006.php on line %d
36NULL
37
38Warning: shm_remove_var(): variable key -10 doesn't exist in %s006.php on line %d
39bool(false)
40string(11) "test string"
41bool(true)
42
43Warning: shm_get_var(): variable key 1 doesn't exist in %s006.php on line %d
44bool(false)
45
46Warning: shm_remove_var(): variable key 1 doesn't exist in %s006.php on line %d
47bool(false)
48
49Warning: shm_get_var(): variable key 1 doesn't exist in %s006.php on line %d
50bool(false)
51Done
52