xref: /PHP-7.0/ext/sysvshm/tests/006.phpt (revision ceb1ea37)
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--
32
33Warning: shm_remove_var() expects exactly 2 parameters, 0 given in %s006.php on line %d
34NULL
35
36Warning: shm_remove_var() expects parameter 1 to be resource, integer given in %s006.php on line %d
37NULL
38
39Warning: shm_remove_var(): variable key -10 doesn't exist in %s006.php on line %d
40bool(false)
41string(11) "test string"
42bool(true)
43
44Warning: shm_get_var(): variable key 1 doesn't exist in %s006.php on line %d
45bool(false)
46
47Warning: shm_remove_var(): variable key 1 doesn't exist in %s006.php on line %d
48bool(false)
49
50Warning: shm_get_var(): variable key 1 doesn't exist in %s006.php on line %d
51bool(false)
52Done
53