Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F625162
amqpqueue_nested_arrays.phpt
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
amqpqueue_nested_arrays.phpt
View Options
--TEST--
AMQPQueue::get headers
--SKIPIF--
<?php
if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
elseif (!getenv("PHP_AMQP_HOST")) print "skip PHP_AMQP_HOST environment variable is not set";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_TOPIC);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue1' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($ex->getName(), '#');
// publish a message:
$ex->publish(
'body', 'routing.1', AMQP_NOPARAM, array(
'headers' => array(
'foo' => 'bar',
'baz' => array('a', 'bc', 'def')
)
)
);
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
var_dump($msg->getHeaders());
echo $msg->getHeader('foo') . "\n";
var_dump($msg->getHeader('baz'));
$ex->delete();
$q->delete();
?>
--EXPECT--
array(2) {
["foo"]=>
string(3) "bar"
["baz"]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(2) "bc"
[2]=>
string(3) "def"
}
}
bar
array(3) {
[0]=>
string(1) "a"
[1]=>
string(2) "bc"
[2]=>
string(3) "def"
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 11:08 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
134203
Default Alt Text
amqpqueue_nested_arrays.phpt (1 KB)
Attached To
Mode
R113 php-ampqp
Attached
Detach File
Event Timeline