xref: /PHP-7.2/ext/sysvshm/tests/004.phpt (revision 17ccbeec)
1--TEST--
2shm_put_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
14var_dump(shm_put_var());
15var_dump(shm_put_var(-1, -1, -1));
16var_dump(shm_put_var(-1, 10, "qwerty"));
17var_dump(shm_put_var($s, -1, "qwerty"));
18var_dump(shm_put_var($s, 10, "qwerty"));
19var_dump(shm_put_var($s, 10, "qwerty"));
20
21$string = str_repeat("test", 512);
22var_dump(shm_put_var($s, 11, $string));
23
24shm_remove($s);
25
26echo "Done\n";
27?>
28--EXPECTF--
29Warning: shm_put_var() expects exactly 3 parameters, 0 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
34
35Warning: shm_put_var() expects parameter 1 to be resource, integer given in %s004.php on line %d
36NULL
37bool(true)
38bool(true)
39bool(true)
40
41Warning: shm_put_var(): not enough shared memory left in %s004.php on line 14
42bool(false)
43Done
44