xref: /PHP-5.4/ext/sysvshm/tests/002.phpt (revision 1fa3b21c)
1--TEST--
2shm_attach() tests
3--SKIPIF--
4<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
5--FILE--
6<?php
7
8$key = ftok(__FILE__, 't');
9
10var_dump(shm_attach());
11var_dump(shm_attach(1,2,3,4));
12
13var_dump(shm_attach(-1, 0));
14var_dump(shm_attach(0, -1));
15var_dump(shm_attach(123, -1));
16var_dump($s = shm_attach($key, -1));
17shm_remove($s);
18var_dump($s = shm_attach($key, 0));
19shm_remove($s);
20
21var_dump($s = shm_attach($key, 1024));
22shm_remove($key);
23var_dump($s = shm_attach($key, 1024));
24shm_remove($s);
25var_dump(shm_attach($key, 1024, 0666));
26shm_remove($s);
27
28var_dump($s = shm_attach($key, 1024));
29shm_remove($s);
30var_dump($s = shm_attach($key));
31shm_remove($s);
32
33echo "Done\n";
34?>
35--EXPECTF--
36Warning: shm_attach() expects at least 1 parameter, 0 given in %s on line %d
37NULL
38
39Warning: shm_attach() expects at most 3 parameters, 4 given in %s on line %d
40NULL
41
42Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
43bool(false)
44
45Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
46bool(false)
47
48Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
49bool(false)
50
51Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
52bool(false)
53
54Warning: shm_remove() expects parameter 1 to be resource, boolean given in %s on line %d
55
56Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
57bool(false)
58
59Warning: shm_remove() expects parameter 1 to be resource, boolean given in %s on line %d
60resource(%d) of type (sysvshm)
61
62Warning: shm_remove() expects parameter 1 to be resource, integer given in %s on line %d
63resource(%d) of type (sysvshm)
64resource(%d) of type (sysvshm)
65resource(%d) of type (sysvshm)
66resource(%d) of type (sysvshm)
67Done
68