forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path004.phpt
59 lines (52 loc) · 1.33 KB
/
004.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--TEST--
msg_set_queue() and msg_stat_queue()
--EXTENSIONS--
sysvmsg
--FILE--
<?php
$id = ftok(__FILE__, 'r');
$q = msg_get_queue($id);
echo "Set mode:\n";
$arr = array('msg_perm.mode' => 0600);
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
echo "Set uid:\n"; // same as the running user to make it succeed
$arr = array('msg_perm.uid' => getmyuid());
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
echo "Set gid:\n"; // same as the running user to make it succeed
$arr = array('msg_perm.gid' => getmygid());
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
echo "Set smaller qbytes:\n";
$res = msg_stat_queue($q);
$arr = array('msg_qbytes' => ($res['msg_qbytes'] -1));
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
if (!msg_remove_queue($q)) {
echo "BAD: queue removal failed\n";
}
echo "Done\n";
?>
--EXPECT--
Set mode:
bool(true)
Did really work:
bool(true)
Set uid:
bool(true)
Did really work:
bool(true)
Set gid:
bool(true)
Did really work:
bool(true)
Set smaller qbytes:
bool(true)
Did really work:
bool(true)
Done