xref: /PHP-5.3/ext/sysvshm/tests/004.phpt (revision 6651864c)
1--TEST--
2shm_put_var() tests
3--SKIPIF--
4<?php if (!extension_loaded("sysvshm")) print "skip"; ?>
5--FILE--
6<?php
7
8$key = ftok(__FILE__, 't');
9$s = shm_attach($key, 1024);
10
11var_dump(shm_put_var());
12var_dump(shm_put_var(-1, -1, -1));
13var_dump(shm_put_var(-1, 10, "qwerty"));
14var_dump(shm_put_var($s, -1, "qwerty"));
15var_dump(shm_put_var($s, 10, "qwerty"));
16var_dump(shm_put_var($s, 10, "qwerty"));
17
18$string = str_repeat("test", 512);
19var_dump(shm_put_var($s, 11, $string));
20
21shm_remove($s);
22
23echo "Done\n";
24?>
25--EXPECTF--
26Warning: shm_put_var() expects exactly 3 parameters, 0 given in %s004.php on line %d
27NULL
28
29Warning: shm_put_var() expects parameter 1 to be resource, integer given in %s004.php on line %d
30NULL
31
32Warning: shm_put_var() expects parameter 1 to be resource, integer given in %s004.php on line %d
33NULL
34bool(true)
35bool(true)
36bool(true)
37
38Warning: shm_put_var(): not enough shared memory left in %s004.php on line 14
39bool(false)
40Done
41