xref: /PHP-5.4/ext/sysvmsg/tests/006.phpt (revision d81ea16e)
1--TEST--
2msg_send() data types when not serializing
3--SKIPIF--
4<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extenions is not available")?>
5--FILE--
6<?php
7
8$queue = msg_get_queue (ftok(__FILE__, 'r'), 0600);
9
10$tests = array('foo', 123, PHP_INT_MAX +1, true, 1.01, null, array('bar'));
11
12foreach ($tests as $elem) {
13    echo @"Sending/receiving '$elem':\n";
14    var_dump(msg_send($queue, 1, $elem, false));
15
16    unset($msg);
17    var_dump(msg_receive($queue, 1, $msg_type, 1024, $msg, false, MSG_IPC_NOWAIT));
18
19    var_dump($elem == $msg);
20    var_dump($elem === $msg);
21}
22
23if (!msg_remove_queue($queue)) {
24	echo "BAD: queue removal failed\n";
25}
26
27echo "Done\n";
28?>
29--EXPECTF--
30Sending/receiving 'foo':
31bool(true)
32bool(true)
33bool(true)
34bool(true)
35Sending/receiving '123':
36bool(true)
37bool(true)
38bool(true)
39bool(false)
40Sending/receiving '%s':
41bool(true)
42bool(true)
43bool(true)
44bool(false)
45Sending/receiving '1':
46bool(true)
47bool(true)
48bool(true)
49bool(false)
50Sending/receiving '1.01':
51bool(true)
52bool(true)
53bool(true)
54bool(false)
55Sending/receiving '':
56
57Warning: msg_send(): Message parameter must be either a string or a number. in %s on line %d
58bool(false)
59bool(false)
60bool(true)
61bool(false)
62Sending/receiving 'Array':
63
64Warning: msg_send(): Message parameter must be either a string or a number. in %s on line %d
65bool(false)
66bool(false)
67bool(false)
68bool(false)
69Done
70