xref: /PHP-8.0/ext/sysvshm/tests/004.phpt (revision d1764ca3)
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($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--
26bool(true)
27bool(true)
28bool(true)
29
30Warning: shm_put_var(): Not enough shared memory left in %s004.php on line %d
31bool(false)
32Done
33