xref: /PHP-8.1/ext/sysvshm/tests/004.phpt (revision 74859783)
1--TEST--
2shm_put_var() tests
3--EXTENSIONS--
4sysvshm
5--SKIPIF--
6<?php
7
8if (!function_exists('ftok')){ print 'skip'; }
9?>
10--FILE--
11<?php
12
13$key = ftok(__FILE__, 't');
14$s = shm_attach($key, 1024);
15
16var_dump(shm_put_var($s, -1, "qwerty"));
17var_dump(shm_put_var($s, 10, "qwerty"));
18var_dump(shm_put_var($s, 10, "qwerty"));
19
20$string = str_repeat("test", 512);
21var_dump(shm_put_var($s, 11, $string));
22
23shm_remove($s);
24
25echo "Done\n";
26?>
27--EXPECTF--
28bool(true)
29bool(true)
30bool(true)
31
32Warning: shm_put_var(): Not enough shared memory left in %s004.php on line %d
33bool(false)
34Done
35