Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
758 KB
Referenced Files
None
Subscribers
None
This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/amqp-2.1.0/tests/amqpqueue_purge_basic.phpt b/amqp-2.1.0/tests/amqpqueue_purge_basic.phpt
deleted file mode 100644
index 464de48..0000000
--- a/amqp-2.1.0/tests/amqpqueue_purge_basic.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-AMQPQueue
---SKIPIF--
-<?php
-if (!extension_loaded("amqp")) print "skip";
-?>
---FILE--
-<?php
-?>
---EXPECT--
diff --git a/amqp-2.1.0/CREDITS b/amqp-2.1.1/CREDITS
similarity index 100%
rename from amqp-2.1.0/CREDITS
rename to amqp-2.1.1/CREDITS
diff --git a/amqp-2.1.0/LICENSE b/amqp-2.1.1/LICENSE
similarity index 100%
rename from amqp-2.1.0/LICENSE
rename to amqp-2.1.1/LICENSE
diff --git a/amqp-2.1.0/amqp.c b/amqp-2.1.1/amqp.c
similarity index 100%
rename from amqp-2.1.0/amqp.c
rename to amqp-2.1.1/amqp.c
diff --git a/amqp-2.1.0/amqp_basic_properties.c b/amqp-2.1.1/amqp_basic_properties.c
similarity index 100%
rename from amqp-2.1.0/amqp_basic_properties.c
rename to amqp-2.1.1/amqp_basic_properties.c
diff --git a/amqp-2.1.0/amqp_basic_properties.h b/amqp-2.1.1/amqp_basic_properties.h
similarity index 100%
rename from amqp-2.1.0/amqp_basic_properties.h
rename to amqp-2.1.1/amqp_basic_properties.h
diff --git a/amqp-2.1.0/amqp_channel.c b/amqp-2.1.1/amqp_channel.c
similarity index 99%
rename from amqp-2.1.0/amqp_channel.c
rename to amqp-2.1.1/amqp_channel.c
index 53eca3b..253f6b4 100644
--- a/amqp-2.1.0/amqp_channel.c
+++ b/amqp-2.1.1/amqp_channel.c
@@ -1,1541 +1,1543 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
#if PHP_VERSION_ID >= 80000
#include <stdint.h>
#else
#include "win32/php_stdint.h"
#endif
#include "win32/signal.h"
#else
#include <stdint.h>
#include <signal.h>
#endif
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#include <rabbitmq-c/framing.h>
#else
#include <amqp.h>
#include <amqp_framing.h>
#endif
#ifdef PHP_WIN32
#include "win32/unistd.h"
#else
#include <unistd.h>
#endif
#include "php_amqp.h"
#include "amqp_connection.h"
#include "amqp_methods_handling.h"
#include "amqp_connection_resource.h"
#include "amqp_channel.h"
zend_class_entry *amqp_channel_class_entry;
#define this_ce amqp_channel_class_entry
zend_object_handlers amqp_channel_object_handlers;
void php_amqp_close_channel(amqp_channel_resource *channel_resource, bool throw)
{
assert(channel_resource != NULL);
amqp_connection_resource *connection_resource = channel_resource->connection_resource;
if (connection_resource != NULL) {
/* First, remove it from active channels table to prevent recursion in case of connection error */
php_amqp_connection_resource_unregister_channel(connection_resource, channel_resource->channel_id);
} else {
channel_resource->is_connected = '\0';
}
assert(channel_resource->connection_resource == NULL);
if (!channel_resource->is_connected) {
/* Nothing to do more - channel was previously marked as closed, possibly, due to channel-level error */
return;
}
channel_resource->is_connected = '\0';
if (connection_resource && connection_resource->is_connected && channel_resource->channel_id > 0) {
assert(connection_resource != NULL);
amqp_rpc_reply_t close_res =
amqp_channel_close(connection_resource->connection_state, channel_resource->channel_id, AMQP_REPLY_SUCCESS);
if (throw && PHP_AMQP_MAYBE_ERROR(close_res, channel_resource)) {
php_amqp_zend_throw_exception_short(close_res, amqp_channel_exception_class_entry);
goto err;
}
if (close_res.reply_type != AMQP_RESPONSE_NORMAL) {
goto err;
}
amqp_rpc_reply_t reply_res = amqp_get_rpc_reply(connection_resource->connection_state);
if (throw && PHP_AMQP_MAYBE_ERROR(reply_res, channel_resource)) {
php_amqp_zend_throw_exception_short(reply_res, amqp_channel_exception_class_entry);
goto err;
}
if (reply_res.reply_type != AMQP_RESPONSE_NORMAL) {
goto err;
}
php_amqp_maybe_release_buffers_on_channel(connection_resource, channel_resource);
return;
err:
// Mark failed slot as used
connection_resource->used_slots++;
return;
}
}
static void php_amqp_destroy_fci(zend_fcall_info *fci)
{
if (fci->size > 0) {
zval_ptr_dtor(&fci->function_name);
if (fci->object != NULL) {
GC_DELREF(fci->object);
}
fci->size = 0;
}
}
static void php_amqp_duplicate_fci(zend_fcall_info *source)
{
if (source->size > 0) {
zval_add_ref(&source->function_name);
if (source->object != NULL) {
GC_ADDREF(source->object);
}
}
}
static int php_amqp_get_fci_gc_data_count(zend_fcall_info *fci)
{
int cnt = 0;
if (fci->size > 0) {
cnt++;
if (fci->object != NULL) {
cnt++;
}
}
return cnt;
}
static zval *php_amqp_get_fci_gc_data(zend_fcall_info *fci, zval *gc_data)
{
if (ZEND_FCI_INITIALIZED(*fci)) {
ZVAL_COPY_VALUE(gc_data++, &fci->function_name);
if (fci->object != NULL) {
ZVAL_OBJ(gc_data++, fci->object);
}
}
return gc_data;
}
#if PHP_MAJOR_VERSION < 8
static HashTable *amqp_channel_gc(zval *object, zval **table, int *n) /* {{{ */
{
amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(object);
#else
static HashTable *amqp_channel_gc(zend_object *object, zval **table, int *n) /* {{{ */
{
amqp_channel_object *channel = php_amqp_channel_object_fetch(object);
#endif
int basic_return_cnt = php_amqp_get_fci_gc_data_count(&channel->callbacks.basic_return.fci);
int basic_ack_cnt = php_amqp_get_fci_gc_data_count(&channel->callbacks.basic_ack.fci);
int basic_nack_cnt = php_amqp_get_fci_gc_data_count(&channel->callbacks.basic_nack.fci);
int cnt = basic_return_cnt + basic_ack_cnt + basic_nack_cnt;
if (cnt > channel->gc_data_count) {
channel->gc_data_count = cnt;
channel->gc_data = (zval *) erealloc(channel->gc_data, sizeof(zval) * cnt);
}
zval *gc_data = channel->gc_data;
gc_data = php_amqp_get_fci_gc_data(&channel->callbacks.basic_return.fci, gc_data);
gc_data = php_amqp_get_fci_gc_data(&channel->callbacks.basic_ack.fci, gc_data);
php_amqp_get_fci_gc_data(&channel->callbacks.basic_nack.fci, gc_data);
*table = channel->gc_data;
*n = cnt;
return zend_std_get_properties(object);
} /* }}} */
static void php_amqp_clean_callbacks(amqp_channel_callbacks *callbacks)
{
php_amqp_destroy_fci(&callbacks->basic_return.fci);
php_amqp_destroy_fci(&callbacks->basic_ack.fci);
php_amqp_destroy_fci(&callbacks->basic_nack.fci);
}
void amqp_channel_free(zend_object *object)
{
amqp_channel_object *channel = PHP_AMQP_FETCH_CHANNEL(object);
if (channel->channel_resource != NULL) {
php_amqp_close_channel(channel->channel_resource, 0);
efree(channel->channel_resource);
channel->channel_resource = NULL;
}
if (channel->gc_data) {
efree(channel->gc_data);
}
php_amqp_clean_callbacks(&channel->callbacks);
zend_object_std_dtor(&channel->zo);
}
zend_object *amqp_channel_ctor(zend_class_entry *ce)
{
amqp_channel_object *channel =
(amqp_channel_object *) ecalloc(1, sizeof(amqp_channel_object) + zend_object_properties_size(ce));
zend_object_std_init(&channel->zo, ce);
AMQP_OBJECT_PROPERTIES_INIT(channel->zo, ce);
#if PHP_MAJOR_VERSION >= 7
channel->zo.handlers = &amqp_channel_object_handlers;
return &channel->zo;
#else
zend_object *new_value;
new_value.handle =
zend_objects_store_put(channel, NULL, (zend_objects_free_object_storage_t) amqp_channel_free, NULL);
new_value.handlers = zend_get_std_object_handlers();
return new_value;
#endif
}
/* {{{ proto AMQPChannel::__construct(AMQPConnection obj)
*/
static PHP_METHOD(amqp_channel_class, __construct)
{
zval rv;
zval *connection_object = NULL;
amqp_channel_resource *channel_resource;
amqp_channel_object *channel;
amqp_connection_object *connection;
/* Parse out the method parameters */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &connection_object, amqp_connection_class_entry) == FAILURE) {
zend_throw_exception(amqp_channel_exception_class_entry, "Parameter must be an instance of AMQPConnection.", 0);
RETURN_NULL();
}
zval consumers;
ZVAL_UNDEF(&consumers);
array_init(&consumers);
zend_update_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("consumers"), &consumers);
zval_ptr_dtor(&consumers);
channel = PHP_AMQP_GET_CHANNEL(getThis());
/* Set the prefetch count */
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("prefetchCount"),
INI_INT("amqp.prefetch_count")
);
/* Set the prefetch size */
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("prefetchSize"),
INI_INT("amqp.prefetch_size")
);
/* Set the global prefetch count */
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("globalPrefetchCount"),
INI_INT("amqp.global_prefetch_count")
);
/* Set the global prefetch size */
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("globalPrefetchSize"),
INI_INT("amqp.global_prefetch_size")
);
/* Pull out and verify the connection */
connection = PHP_AMQP_GET_CONNECTION(connection_object);
PHP_AMQP_VERIFY_CONNECTION(connection, "Could not create channel.");
if (!connection->connection_resource) {
zend_throw_exception(
amqp_channel_exception_class_entry,
"Could not create channel. No connection resource.",
0
);
RETURN_THROWS();
}
if (!connection->connection_resource->is_connected) {
zend_throw_exception(
amqp_channel_exception_class_entry,
"Could not create channel. Connection resource is not connected.",
0
);
return;
}
zend_update_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("connection"), connection_object);
channel_resource = (amqp_channel_resource *) ecalloc(1, sizeof(amqp_channel_resource));
channel->channel_resource = channel_resource;
channel_resource->parent = channel;
/* Figure out what the next available channel is on this connection */
channel_resource->channel_id =
php_amqp_connection_resource_get_available_channel_id(connection->connection_resource);
/* Check that we got a valid channel */
if (!channel_resource->channel_id) {
zend_throw_exception(
amqp_channel_exception_class_entry,
"Could not create channel. Connection has no open channel slots remaining.",
0
);
return;
}
if (php_amqp_connection_resource_register_channel(
connection->connection_resource,
channel_resource,
channel_resource->channel_id
) == FAILURE) {
zend_throw_exception(
amqp_channel_exception_class_entry,
"Could not create channel. Failed to add channel to connection slot.",
0
);
}
/* Open up the channel for use */
amqp_channel_open_ok_t *r =
amqp_channel_open(channel_resource->connection_resource->connection_state, channel_resource->channel_id);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_channel_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
/* Prevent double free, it may happen in case the channel resource was already freed due to some hard error. */
if (channel_resource->connection_resource) {
php_amqp_connection_resource_unregister_channel(
channel_resource->connection_resource,
channel_resource->channel_id
);
channel_resource->channel_id = 0;
}
return;
}
/* r->channel_id is a 16-bit channel number inside amqp_bytes_t, assertion below will without converting to uint16_t*/
/* assert (r->channel_id == channel_resource->channel_id);*/
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
channel_resource->is_connected = '\1';
/* Set the prefetch count: */
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
0, /* prefetch window size */
(uint16_t) PHP_AMQP_READ_THIS_PROP_LONG("prefetchCount"), /* prefetch message count */
/* NOTE that RabbitMQ has reinterpreted global flag field. See https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos.global for details */
0 /* global flag */
);
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
uint32_t global_prefetch_size = (uint32_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchSize");
uint16_t global_prefetch_count = (uint16_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchCount");
/* Set the global prefetch settings (ignoring if 0 for backwards compatibility) */
if (global_prefetch_size != 0 || global_prefetch_count != 0) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
global_prefetch_size,
global_prefetch_count,
1
);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
}
/* }}} */
/* {{{ proto bool amqp::isConnected()
check amqp channel */
static PHP_METHOD(amqp_channel_class, isConnected)
{
amqp_channel_resource *channel_resource;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
RETURN_BOOL(channel_resource && channel_resource->is_connected);
}
/* }}} */
/* {{{ proto bool AMQPChannel::close()
Close amqp channel */
static PHP_METHOD(amqp_channel_class, close)
{
amqp_channel_resource *channel_resource;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
if (channel_resource && channel_resource->is_connected) {
php_amqp_close_channel(channel_resource, 1);
}
}
/* }}} */
/* {{{ proto bool amqp::getChannelId()
get amqp channel ID */
static PHP_METHOD(amqp_channel_class, getChannelId)
{
amqp_channel_resource *channel_resource;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
if (!channel_resource) {
RETURN_NULL();
}
RETURN_LONG(channel_resource->channel_id);
}
/* }}} */
/* {{{ proto bool amqp::setPrefetchCount(long count)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, setPrefetchCount)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long prefetch_count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prefetch_count) == FAILURE) {
RETURN_THROWS();
}
if (!php_amqp_is_valid_prefetch_count(prefetch_count)) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'prefetchCount' must be between 0 and %u.",
PHP_AMQP_MAX_PREFETCH_COUNT
);
return;
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_CONNECTION_RESOURCE(channel_resource, "Could not set prefetch count.");
// TODO: verify that connection is active and resource exists. that is enough
/* If we are already connected, set the new prefetch count */
if (channel_resource->is_connected) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
0,
(uint16_t) prefetch_count,
0
);
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
uint32_t global_prefetch_size = (uint32_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchSize");
uint16_t global_prefetch_count = (uint16_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchCount");
/* Re-apply current global prefetch settings if set (writing consumer prefetch settings will clear global prefetch settings) */
if (global_prefetch_size != 0 || global_prefetch_count != 0) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
global_prefetch_size,
global_prefetch_count,
1
);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
}
/* Set the prefetch count - the implication is to disable the size */
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("prefetchCount"), prefetch_count);
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("prefetchSize"), 0);
}
/* }}} */
/* {{{ proto long amqp::getPrefetchCount()
get the number of prefetches */
static PHP_METHOD(amqp_channel_class, getPrefetchCount)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("prefetchCount")
}
/* }}} */
/* {{{ proto bool amqp::setPrefetchSize(long size)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, setPrefetchSize)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long prefetch_size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prefetch_size) == FAILURE) {
RETURN_THROWS();
}
if (!php_amqp_is_valid_prefetch_size(prefetch_size)) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'prefetchSize' must be between 0 and %u.",
PHP_AMQP_MAX_PREFETCH_SIZE
);
return;
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_CONNECTION_RESOURCE(channel_resource, "Could not set prefetch size.");
/* If we are already connected, set the new prefetch count */
if (channel_resource->is_connected) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(uint32_t) prefetch_size,
0,
0
);
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
uint32_t global_prefetch_size = (uint32_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchSize");
uint16_t global_prefetch_count = (uint16_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchCount");
/* Re-apply current global prefetch settings if set (writing consumer prefetch settings will clear global prefetch settings) */
if (global_prefetch_size != 0 || global_prefetch_count != 0) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
global_prefetch_size,
global_prefetch_count,
1
);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
}
/* Set the prefetch size - the implication is to disable the count */
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("prefetchCount"), 0);
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("prefetchSize"), prefetch_size);
}
/* }}} */
/* {{{ proto long amqp::getPrefetchSize()
get the number of prefetches */
static PHP_METHOD(amqp_channel_class, getPrefetchSize)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("prefetchSize")
}
/* }}} */
/* {{{ proto bool amqp::setGlobalPrefetchCount(long count)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, setGlobalPrefetchCount)
{
amqp_channel_resource *channel_resource;
zend_long global_prefetch_count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &global_prefetch_count) == FAILURE) {
RETURN_THROWS();
}
if (!php_amqp_is_valid_prefetch_count(global_prefetch_count)) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'globalPrefetchCount' must be between 0 and %u.",
PHP_AMQP_MAX_PREFETCH_COUNT
);
return;
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_CONNECTION_RESOURCE(channel_resource, "Could not set global prefetch count.");
/* If we are already connected, set the new prefetch count */
if (channel_resource->is_connected) {
/* Applying global prefetch settings retains existing consumer prefetch settings */
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
0,
(uint16_t) global_prefetch_count,
1
);
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* Set the global prefetch count - the implication is to disable the size */
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("globalPrefetchCount"),
global_prefetch_count
);
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("globalPrefetchSize"), 0);
}
/* }}} */
/* {{{ proto long amqp::getGlobalPrefetchCount()
get the number of prefetches */
static PHP_METHOD(amqp_channel_class, getGlobalPrefetchCount)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("globalPrefetchCount")
}
/* }}} */
/* {{{ proto bool amqp::setGlobalPrefetchSize(long size)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, setGlobalPrefetchSize)
{
amqp_channel_resource *channel_resource;
zend_long global_prefetch_size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &global_prefetch_size) == FAILURE) {
RETURN_THROWS();
}
if (!php_amqp_is_valid_prefetch_size(global_prefetch_size)) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'globalPrefetchSize' must be between 0 and %u.",
PHP_AMQP_MAX_PREFETCH_SIZE
);
return;
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_CONNECTION_RESOURCE(channel_resource, "Could not set prefetch size.");
/* If we are already connected, set the new prefetch count */
if (channel_resource->is_connected) {
/* Applying global prefetch settings retains existing consumer prefetch settings */
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(uint32_t) global_prefetch_size,
0,
1
);
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* Set the global prefetch size - the implication is to disable the count */
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("globalPrefetchCount"), 0);
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("globalPrefetchSize"),
global_prefetch_size
);
}
/* }}} */
/* {{{ proto long amqp::getGlobalPrefetchSize()
get the number of prefetches */
static PHP_METHOD(amqp_channel_class, getGlobalPrefetchSize)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("globalPrefetchSize")
}
/* }}} */
/* {{{ proto amqp::qos(long size, long count, bool global)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, qos)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long prefetch_size;
zend_long prefetch_count;
bool global = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|b", &prefetch_size, &prefetch_count, &global) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_CONNECTION_RESOURCE(channel_resource, "Could not set qos parameters.");
/* Set the prefetch size and prefetch count */
if (global) {
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("globalPrefetchSize"),
prefetch_size
);
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("globalPrefetchCount"),
prefetch_count
);
} else {
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("prefetchSize"), prefetch_size);
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("prefetchCount"),
prefetch_count
);
}
/* If we are already connected, set the new prefetch count */
if (channel_resource->is_connected) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(uint32_t) PHP_AMQP_READ_THIS_PROP_LONG("prefetchSize"),
(uint16_t) PHP_AMQP_READ_THIS_PROP_LONG("prefetchCount"),
/* NOTE that RabbitMQ has reinterpreted global flag field. See https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos.global for details */
0 /* Global flag - whether this change should affect every channel_resource */
);
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
uint32_t global_prefetch_size = (uint32_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchSize");
uint16_t global_prefetch_count = (uint16_t) PHP_AMQP_READ_THIS_PROP_LONG("globalPrefetchCount");
/* Re-apply current global prefetch settings if set (writing consumer prefetch settings will clear global prefetch settings) */
if (global_prefetch_size != 0 || global_prefetch_count != 0) {
amqp_basic_qos(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
global_prefetch_size,
global_prefetch_count,
1
);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
}
}
/* }}} */
/* {{{ proto amqp::startTransaction()
start a transaction on the given channel */
static PHP_METHOD(amqp_channel_class, startTransaction)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not start the transaction.");
amqp_tx_select(channel_resource->connection_resource->connection_state, channel_resource->channel_id);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto amqp::startTransaction()
start a transaction on the given channel */
static PHP_METHOD(amqp_channel_class, commitTransaction)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not start the transaction.");
amqp_tx_commit(channel_resource->connection_resource->connection_state, channel_resource->channel_id);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto amqp::startTransaction()
start a transaction on the given channel */
static PHP_METHOD(amqp_channel_class, rollbackTransaction)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not rollback the transaction.");
amqp_tx_rollback(channel_resource->connection_resource->connection_state, channel_resource->channel_id);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto AMQPChannel::getConnection()
Get the AMQPConnection object in use */
static PHP_METHOD(amqp_channel_class, getConnection)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("connection")
}
/* }}} */
/* {{{ proto bool amqp::basicRecover([bool requeue=TRUE])
Redeliver unacknowledged messages */
static PHP_METHOD(amqp_channel_class, basicRecover)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
bool requeue = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &requeue) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not redeliver unacknowledged messages.");
amqp_basic_recover(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(amqp_boolean_t) requeue
);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto bool amqp::confirmSelect()
Redeliver unacknowledged messages */
PHP_METHOD(amqp_channel_class, confirmSelect)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(getThis());
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not enable confirms mode.");
amqp_confirm_select(channel_resource->connection_resource->connection_state, channel_resource->channel_id);
res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto bool AMQPChannel::setReturnCallback(callable return_callback)
Set callback for basic.return server method handling */
PHP_METHOD(amqp_channel_class, setReturnCallback)
{
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fcc = empty_fcall_info_cache;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "f!", &fci, &fcc) == FAILURE) {
RETURN_THROWS();
}
amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(getThis());
php_amqp_destroy_fci(&channel->callbacks.basic_return.fci);
if (ZEND_FCI_INITIALIZED(fci)) {
php_amqp_duplicate_fci(&fci);
channel->callbacks.basic_return.fci = fci;
channel->callbacks.basic_return.fcc = fcc;
}
}
/* }}} */
/* {{{ proto bool AMQPChannel::waitForBasicReturn([double timeout=0.0])
Wait for basic.return method from server */
PHP_METHOD(amqp_channel_class, waitForBasicReturn)
{
amqp_channel_object *channel;
amqp_channel_resource *channel_resource;
amqp_method_t method;
int status;
double timeout = 0;
struct timeval tv = {0};
struct timeval *tv_ptr = &tv;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|d", &timeout) == FAILURE) {
RETURN_THROWS();
}
if (timeout < 0) {
zend_throw_exception(amqp_channel_exception_class_entry, "Timeout must be greater than or equal to zero.", 0);
return;
}
channel = PHP_AMQP_GET_CHANNEL(getThis());
channel_resource = channel->channel_resource;
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not start wait loop for basic.return method.");
if (timeout > 0) {
tv.tv_sec = (long int) timeout;
tv.tv_usec = (long int) ((timeout - tv.tv_sec) * 1000000);
} else {
tv_ptr = NULL;
}
assert(channel_resource->channel_id > 0);
while (1) {
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
status = amqp_simple_wait_method_noblock(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
AMQP_BASIC_RETURN_METHOD,
&method,
tv_ptr
);
if (AMQP_STATUS_TIMEOUT == status) {
zend_throw_exception(amqp_queue_exception_class_entry, "Wait timeout exceed", 0);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
if (status != AMQP_STATUS_OK) {
/* Emulate library error */
amqp_rpc_reply_t res;
if (AMQP_RESPONSE_SERVER_EXCEPTION == status) {
res.reply_type = AMQP_RESPONSE_SERVER_EXCEPTION;
res.reply = method;
} else {
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
}
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
status = php_amqp_handle_basic_return(&PHP_AMQP_G(error_message), channel, &method);
if (PHP_AMQP_RESOURCE_RESPONSE_BREAK == status) {
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
break;
}
if (PHP_AMQP_RESOURCE_RESPONSE_OK != status) {
/* Emulate library error */
amqp_rpc_reply_t res;
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_channel_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
}
}
/* }}} */
/* {{{ proto bool AMQPChannel::setConfirmCallback(callable ack_callback [, callable nack_callback = null])
Set callback for basic.ack and, optionally, basic.nac server methods handling */
PHP_METHOD(amqp_channel_class, setConfirmCallback)
{
zend_fcall_info ack_fci = empty_fcall_info;
zend_fcall_info_cache ack_fcc = empty_fcall_info_cache;
zend_fcall_info nack_fci = empty_fcall_info;
zend_fcall_info_cache nack_fcc = empty_fcall_info_cache;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "f!|f!", &ack_fci, &ack_fcc, &nack_fci, &nack_fcc) == FAILURE) {
RETURN_THROWS();
}
amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(getThis());
php_amqp_destroy_fci(&channel->callbacks.basic_ack.fci);
if (ZEND_FCI_INITIALIZED(ack_fci)) {
php_amqp_duplicate_fci(&ack_fci);
channel->callbacks.basic_ack.fci = ack_fci;
channel->callbacks.basic_ack.fcc = ack_fcc;
}
php_amqp_destroy_fci(&channel->callbacks.basic_nack.fci);
if (ZEND_FCI_INITIALIZED(nack_fci)) {
php_amqp_duplicate_fci(&nack_fci);
channel->callbacks.basic_nack.fci = nack_fci;
channel->callbacks.basic_nack.fcc = nack_fcc;
}
}
/* }}} */
/* {{{ proto bool amqp::waitForConfirm([double timeout=0.0])
Redeliver unacknowledged messages */
PHP_METHOD(amqp_channel_class, waitForConfirm)
{
amqp_channel_object *channel;
amqp_channel_resource *channel_resource;
amqp_method_t method;
int status;
double timeout = 0;
struct timeval tv = {0};
struct timeval *tv_ptr = &tv;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|d", &timeout) == FAILURE) {
RETURN_THROWS();
}
if (timeout < 0) {
zend_throw_exception(amqp_channel_exception_class_entry, "Timeout must be greater than or equal to zero.", 0);
return;
}
channel = PHP_AMQP_GET_CHANNEL(getThis());
channel_resource = channel->channel_resource;
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not start wait loop for basic.return method.");
if (timeout > 0) {
tv.tv_sec = (long int) timeout;
tv.tv_usec = (long int) ((timeout - tv.tv_sec) * 1000000);
} else {
tv_ptr = NULL;
}
assert(channel_resource->channel_id > 0);
amqp_method_number_t expected_methods[] =
{AMQP_BASIC_ACK_METHOD, AMQP_BASIC_NACK_METHOD, AMQP_BASIC_RETURN_METHOD, 0};
while (1) {
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
status = amqp_simple_wait_method_list_noblock(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
expected_methods,
&method,
tv_ptr
);
if (AMQP_STATUS_TIMEOUT == status) {
zend_throw_exception(amqp_queue_exception_class_entry, "Wait timeout exceed", 0);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
if (status != AMQP_STATUS_OK) {
/* Emulate library error */
amqp_rpc_reply_t res;
if (AMQP_RESPONSE_SERVER_EXCEPTION == status) {
res.reply_type = AMQP_RESPONSE_SERVER_EXCEPTION;
res.reply = method;
} else {
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
}
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_channel_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
switch (method.id) {
case AMQP_BASIC_ACK_METHOD:
status = php_amqp_handle_basic_ack(&PHP_AMQP_G(error_message), channel, &method);
break;
case AMQP_BASIC_NACK_METHOD:
status = php_amqp_handle_basic_nack(&PHP_AMQP_G(error_message), channel, &method);
break;
case AMQP_BASIC_RETURN_METHOD:
status = php_amqp_handle_basic_return(&PHP_AMQP_G(error_message), channel, &method);
break;
default:
status = AMQP_STATUS_WRONG_METHOD;
}
if (PHP_AMQP_RESOURCE_RESPONSE_BREAK == status) {
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
break;
}
if (PHP_AMQP_RESOURCE_RESPONSE_OK != status) {
/* Emulate library error */
amqp_rpc_reply_t res;
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
}
}
/* }}} */
-/* {{{ proto amqp::getConsumers() */
+/* {{{ proto AMQPChannel::getConsumers() */
static PHP_METHOD(amqp_channel_class, getConsumers)
{
zval rv;
PHP_AMQP_NOPARAMS()
- PHP_AMQP_RETURN_THIS_PROP("consumers");
+ zval *tmp = zend_read_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("consumers"), 0, &rv);
+ // Return a proper copy, so that the internal consumer map can be safely modified
+ ZVAL_DUP(return_value, tmp);
}
/* }}} */
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class__construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_OBJ_INFO(0, connection, AMQPConnection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_isConnected, ZEND_SEND_BY_VAL, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_close, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_getChannelId, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_setPrefetchSize, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_getPrefetchSize, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_setPrefetchCount, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_getPrefetchCount, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_channel_class_setGlobalPrefetchSize,
ZEND_SEND_BY_VAL,
1,
IS_VOID,
0
)
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_channel_class_getGlobalPrefetchSize,
ZEND_SEND_BY_VAL,
0,
IS_LONG,
0
)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_channel_class_setGlobalPrefetchCount,
ZEND_SEND_BY_VAL,
1,
IS_VOID,
0
)
ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_channel_class_getGlobalPrefetchCount,
ZEND_SEND_BY_VAL,
0,
IS_LONG,
0
)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_qos, ZEND_SEND_BY_VAL, 2, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, global, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_startTransaction, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_commitTransaction, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_rollbackTransaction, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO(arginfo_amqp_channel_class_getConnection, AMQPConnection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_basicRecover, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, requeue, _IS_BOOL, 0, "true")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_confirmSelect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_setConfirmCallback, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_CALLABLE_INFO(0, ackCallback, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, nackCallback, IS_CALLABLE, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_waitForConfirm, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 0, "0.0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_setReturnCallback, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_CALLABLE_INFO(0, returnCallback, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_waitForBasicReturn, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 0, "0.0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_channel_class_getConsumers, ZEND_SEND_BY_VAL, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
zend_function_entry amqp_channel_class_functions[] = {
PHP_ME(amqp_channel_class, __construct, arginfo_amqp_channel_class__construct, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, isConnected, arginfo_amqp_channel_class_isConnected, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, close, arginfo_amqp_channel_class_close, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getChannelId, arginfo_amqp_channel_class_getChannelId, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, setPrefetchSize, arginfo_amqp_channel_class_setPrefetchSize, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getPrefetchSize, arginfo_amqp_channel_class_getPrefetchSize, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, setPrefetchCount, arginfo_amqp_channel_class_setPrefetchCount, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getPrefetchCount, arginfo_amqp_channel_class_getPrefetchCount, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, setGlobalPrefetchSize, arginfo_amqp_channel_class_setGlobalPrefetchSize, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getGlobalPrefetchSize, arginfo_amqp_channel_class_getGlobalPrefetchSize, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, setGlobalPrefetchCount, arginfo_amqp_channel_class_setGlobalPrefetchCount, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getGlobalPrefetchCount, arginfo_amqp_channel_class_getGlobalPrefetchCount, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, qos, arginfo_amqp_channel_class_qos, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, startTransaction, arginfo_amqp_channel_class_startTransaction, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, commitTransaction, arginfo_amqp_channel_class_commitTransaction, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, rollbackTransaction, arginfo_amqp_channel_class_rollbackTransaction, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getConnection, arginfo_amqp_channel_class_getConnection, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, basicRecover, arginfo_amqp_channel_class_basicRecover, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, confirmSelect, arginfo_amqp_channel_class_confirmSelect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, waitForConfirm, arginfo_amqp_channel_class_waitForConfirm, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, setConfirmCallback, arginfo_amqp_channel_class_setConfirmCallback, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, setReturnCallback, arginfo_amqp_channel_class_setReturnCallback, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, waitForBasicReturn, arginfo_amqp_channel_class_waitForBasicReturn, ZEND_ACC_PUBLIC)
PHP_ME(amqp_channel_class, getConsumers, arginfo_amqp_channel_class_getConsumers, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
PHP_MINIT_FUNCTION(amqp_channel)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "AMQPChannel", amqp_channel_class_functions);
ce.create_object = amqp_channel_ctor;
amqp_channel_class_entry = zend_register_internal_class(&ce);
PHP_AMQP_DECLARE_TYPED_PROPERTY_OBJ(this_ce, "connection", ZEND_ACC_PRIVATE, AMQPConnection, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "prefetchCount", ZEND_ACC_PRIVATE, IS_LONG, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "prefetchSize", ZEND_ACC_PRIVATE, IS_LONG, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "globalPrefetchCount", ZEND_ACC_PRIVATE, IS_LONG, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "globalPrefetchSize", ZEND_ACC_PRIVATE, IS_LONG, 1);
#if PHP_VERSION_ID >= 80000
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "consumers", ZEND_ACC_PRIVATE, IS_ARRAY, 0, ZVAL_EMPTY_ARRAY);
#else
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "consumers", ZEND_ACC_PRIVATE, IS_ARRAY, 0, ZVAL_NULL);
#endif
#if PHP_MAJOR_VERSION >= 7
memcpy(&amqp_channel_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
amqp_channel_object_handlers.offset = XtOffsetOf(amqp_channel_object, zo);
amqp_channel_object_handlers.free_obj = amqp_channel_free;
#endif
#if ZEND_MODULE_API_NO >= 20100000
amqp_channel_object_handlers.get_gc = amqp_channel_gc;
#endif
return SUCCESS;
}
diff --git a/amqp-2.1.0/amqp_channel.h b/amqp-2.1.1/amqp_channel.h
similarity index 100%
rename from amqp-2.1.0/amqp_channel.h
rename to amqp-2.1.1/amqp_channel.h
diff --git a/amqp-2.1.0/amqp_connection.c b/amqp-2.1.1/amqp_connection.c
similarity index 99%
rename from amqp-2.1.0/amqp_connection.c
rename to amqp-2.1.1/amqp_connection.c
index 6b0a301..7f5573d 100644
--- a/amqp-2.1.0/amqp_connection.c
+++ b/amqp-2.1.1/amqp_connection.c
@@ -1,2006 +1,2006 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
#if PHP_VERSION_ID >= 80000
#include <stdint.h>
#else
#include "win32/php_stdint.h"
#endif
#include "win32/signal.h"
#else
#include <signal.h>
#include <stdint.h>
#endif
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#else
#include <amqp.h>
#endif
#ifdef PHP_WIN32
#include "win32/unistd.h"
#else
#include <unistd.h>
#endif
#include "php_amqp.h"
#include "amqp_channel.h"
#include "amqp_connection_resource.h"
#include "amqp_connection.h"
zend_class_entry *amqp_connection_class_entry;
#define this_ce amqp_connection_class_entry
zend_object_handlers amqp_connection_object_handlers;
#define PHP_AMQP_EXTRACT_CONNECTION_STR(name) \
zdata = NULL; \
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL(name))) != NULL) { \
SEPARATE_ZVAL(zdata); \
convert_to_string(zdata); \
} \
if (zdata && Z_STRLEN_P(zdata) > 0) { \
zend_update_property_string(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL(name), Z_STRVAL_P(zdata)); \
} else if (strlen(INI_STR("amqp." name)) > 0) { \
zend_update_property_string( \
this_ce, \
PHP_AMQP_COMPAT_OBJ_P(getThis()), \
ZEND_STRL(name), \
INI_STR("amqp." name) \
); \
}
#define PHP_AMQP_EXTRACT_CONNECTION_BOOL(name) \
zdata = NULL; \
- if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), (name), sizeof(name))) != NULL) { \
+ if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL(name))) != NULL) { \
SEPARATE_ZVAL(zdata); \
convert_to_long(zdata); \
} \
if (zdata) { \
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL(name), Z_LVAL_P(zdata)); \
} else { \
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL(name), INI_INT("amqp." name)); \
}
static int php_amqp_connection_resource_deleter(zval *el, amqp_connection_resource *connection_resource)
{
if (Z_RES_P(el)->ptr == connection_resource) {
return ZEND_HASH_APPLY_REMOVE | ZEND_HASH_APPLY_STOP;
}
return ZEND_HASH_APPLY_KEEP;
}
static size_t php_amqp_get_connection_hash(amqp_connection_params *params, char **hash)
{
return spprintf(
hash,
0,
"amqp_conn_res_h:%s_p:%d_v:%s_l:%s_p:%s_f:%d_c:%d_h:%d_cacert:%s_cert:%s_key:%s_sasl_method:%d_connection_name:"
"%s",
params->host,
params->port,
params->vhost,
params->login,
params->password,
params->frame_max,
params->channel_max,
params->heartbeat,
params->cacert,
params->cert,
params->key,
params->sasl_method,
params->connection_name
);
}
static void php_amqp_cleanup_connection_resource(amqp_connection_resource *connection_resource)
{
if (!connection_resource) {
return;
}
zend_resource *resource = connection_resource->resource;
connection_resource->parent->connection_resource = NULL;
connection_resource->parent = NULL;
if (connection_resource->is_dirty) {
if (connection_resource->is_persistent) {
zend_hash_apply_with_argument(
&EG(persistent_list),
(apply_func_arg_t) php_amqp_connection_resource_deleter,
(void *) connection_resource
);
}
zend_list_delete(resource);
} else {
if (connection_resource->is_persistent) {
connection_resource->resource = NULL;
}
if (connection_resource->resource != NULL) {
zend_list_delete(resource);
}
}
}
static void php_amqp_disconnect(amqp_connection_resource *resource)
{
php_amqp_prepare_for_disconnect(resource);
php_amqp_cleanup_connection_resource(resource);
}
void php_amqp_disconnect_force(amqp_connection_resource *resource)
{
php_amqp_prepare_for_disconnect(resource);
resource->is_dirty = '\1';
php_amqp_cleanup_connection_resource(resource);
}
/**
* php_amqp_connect
* handles connecting to amqp
* called by connect(), pconnect(), reconnect(), preconnect()
*/
int php_amqp_connect(amqp_connection_object *connection, bool persistent, INTERNAL_FUNCTION_PARAMETERS)
{
zval rv;
char *key = NULL;
size_t key_len = 0;
if (connection->connection_resource) {
/* Clean up old memory allocations which are now invalid (new connection) */
php_amqp_cleanup_connection_resource(connection->connection_resource);
}
assert(connection->connection_resource == NULL);
amqp_connection_params connection_params;
connection_params.host = PHP_AMQP_READ_THIS_PROP_STR("host");
connection_params.port = (int) PHP_AMQP_READ_THIS_PROP_LONG("port");
connection_params.vhost = PHP_AMQP_READ_THIS_PROP_STR("vhost");
connection_params.login = PHP_AMQP_READ_THIS_PROP_STR("login");
connection_params.password = PHP_AMQP_READ_THIS_PROP_STR("password");
connection_params.frame_max = (int) PHP_AMQP_READ_THIS_PROP_LONG("frameMax");
connection_params.channel_max = (int) PHP_AMQP_READ_THIS_PROP_LONG("channelMax");
connection_params.heartbeat = (int) PHP_AMQP_READ_THIS_PROP_LONG("heartbeat");
connection_params.read_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("readTimeout");
connection_params.write_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("writeTimeout");
connection_params.connect_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("connectTimeout");
connection_params.rpc_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("rpcTimeout");
connection_params.cacert = PHP_AMQP_READ_THIS_PROP_STRLEN("cacert") ? PHP_AMQP_READ_THIS_PROP_STR("cacert") : NULL;
connection_params.cert = PHP_AMQP_READ_THIS_PROP_STRLEN("cert") ? PHP_AMQP_READ_THIS_PROP_STR("cert") : NULL;
connection_params.key = PHP_AMQP_READ_THIS_PROP_STRLEN("key") ? PHP_AMQP_READ_THIS_PROP_STR("key") : NULL;
connection_params.verify = (int) PHP_AMQP_READ_THIS_PROP_BOOL("verify");
connection_params.sasl_method = (int) PHP_AMQP_READ_THIS_PROP_LONG("saslMethod");
connection_params.connection_name =
PHP_AMQP_READ_THIS_PROP_STRLEN("connectionName") ? PHP_AMQP_READ_THIS_PROP_STR("connectionName") : NULL;
if (persistent) {
zend_resource *le = NULL;
/* Look for an established resource */
key_len = php_amqp_get_connection_hash(&connection_params, &key);
if ((le = zend_hash_str_find_ptr(&EG(persistent_list), key, key_len)) != NULL) {
efree(key);
if (le->type != le_amqp_connection_resource_persistent) {
/* hash conflict, given name associate with non-amqp persistent connection resource */
zend_throw_exception(
amqp_connection_exception_class_entry,
"Connection hash conflict detected. Persistent connection found that does not belong to AMQP.",
0
);
return 0;
}
/* An entry for this connection resource already exists */
/* Stash the connection resource in the connection */
connection->connection_resource = le->ptr;
if (connection->connection_resource->resource != NULL) {
/* resource in use! */
connection->connection_resource = NULL;
zend_throw_exception(
amqp_connection_exception_class_entry,
"There are already established persistent connection to the same resource.",
0
);
return 0;
}
connection->connection_resource->resource = zend_register_resource(
connection->connection_resource,
persistent ? le_amqp_connection_resource_persistent : le_amqp_connection_resource
);
connection->connection_resource->parent = connection;
/* Set desired timeouts */
if (php_amqp_set_resource_read_timeout(
connection->connection_resource,
PHP_AMQP_READ_THIS_PROP_DOUBLE("readTimeout")
) == 0 ||
php_amqp_set_resource_write_timeout(
connection->connection_resource,
PHP_AMQP_READ_THIS_PROP_DOUBLE("writeTimeout")
) == 0 ||
php_amqp_set_resource_rpc_timeout(
connection->connection_resource,
PHP_AMQP_READ_THIS_PROP_DOUBLE("rpcTimeout")
) == 0) {
php_amqp_disconnect_force(connection->connection_resource);
return 0;
}
/* Set connection status to connected */
connection->connection_resource->is_connected = '\1';
connection->connection_resource->is_persistent = persistent;
return 1;
}
efree(key);
}
connection->connection_resource = connection_resource_constructor(&connection_params, persistent);
if (connection->connection_resource == NULL) {
return 0;
}
connection->connection_resource->resource = zend_register_resource(
connection->connection_resource,
persistent ? le_amqp_connection_resource_persistent : le_amqp_connection_resource
);
connection->connection_resource->parent = connection;
/* Set connection status to connected */
connection->connection_resource->is_connected = '\1';
if (persistent) {
connection->connection_resource->is_persistent = persistent;
key_len = php_amqp_get_connection_hash(&connection_params, &key);
zend_resource new_le;
/* Store a reference in the persistence list */
new_le.ptr = connection->connection_resource;
new_le.type = le_amqp_connection_resource_persistent;
if (!zend_hash_str_update_mem(&EG(persistent_list), key, key_len, &new_le, sizeof(zend_resource))) {
efree(key);
php_amqp_disconnect_force(connection->connection_resource);
zend_throw_exception(
amqp_connection_exception_class_entry,
"Could not store persistent connection in pool.",
0
);
return 0;
}
efree(key);
}
return 1;
}
void amqp_connection_free(zend_object *object)
{
amqp_connection_object *connection = PHP_AMQP_FETCH_CONNECTION(object);
if (connection->connection_resource) {
php_amqp_disconnect(connection->connection_resource);
}
zend_object_std_dtor(&connection->zo);
}
zend_object *amqp_connection_ctor(zend_class_entry *ce)
{
amqp_connection_object *connection =
(amqp_connection_object *) ecalloc(1, sizeof(amqp_connection_object) + zend_object_properties_size(ce));
zend_object_std_init(&connection->zo, ce);
AMQP_OBJECT_PROPERTIES_INIT(connection->zo, ce);
connection->zo.handlers = &amqp_connection_object_handlers;
return &connection->zo;
}
/* {{{ proto AMQPConnection::__construct([array optional])
* The array can contain 'host', 'port', 'login', 'password', 'vhost', 'read_timeout', 'write_timeout', 'connect_timeout', 'rpc_timeout' and 'timeout' (deprecated) indexes
*/
static PHP_METHOD(amqp_connection_class, __construct)
{
zval *ini_arr = NULL;
zval *zdata = NULL;
/* Parse out the method parameters */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a/", &ini_arr) == FAILURE) {
RETURN_THROWS();
}
/* Pull the login out of the $params array */
zdata = NULL;
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("login"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_string(zdata);
}
/* Validate the given login */
if (zdata && Z_STRLEN_P(zdata) > 0) {
if (!php_amqp_is_valid_credential(Z_STR_P(zdata))) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'login' exceeds %d character limit.",
PHP_AMQP_MAX_CREDENTIALS_LENGTH
);
return;
}
zend_update_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("login"), zdata);
} else {
zend_update_property_string(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("login"),
INI_STR("amqp.login")
);
}
/* Pull the password out of the $params array */
zdata = NULL;
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("password"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_string(zdata);
}
/* Validate the given password */
if (zdata && Z_STRLEN_P(zdata) > 0) {
if (!php_amqp_is_valid_credential(Z_STR_P(zdata))) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'password' exceeds %d character limit.",
PHP_AMQP_MAX_CREDENTIALS_LENGTH
);
return;
}
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("password"),
Z_STRVAL_P(zdata),
Z_STRLEN_P(zdata)
);
} else {
zend_update_property_string(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("password"),
INI_STR("amqp.password")
);
}
/* Pull the host out of the $params array */
zdata = NULL;
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("host"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_string(zdata);
}
/* Validate the given host */
if (zdata && Z_STRLEN_P(zdata) > 0) {
if (!php_amqp_is_valid_identifier(Z_STR_P(zdata))) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'host' exceeds %d character limit.",
PHP_AMQP_MAX_IDENTIFIER_LENGTH
);
return;
}
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("host"),
Z_STRVAL_P(zdata),
Z_STRLEN_P(zdata)
);
} else {
zend_update_property_string(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("host"), INI_STR("amqp.host"));
}
/* Pull the vhost out of the $params array */
zdata = NULL;
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("vhost"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_string(zdata);
}
/* Validate the given vhost */
if (zdata && Z_STRLEN_P(zdata) > 0) {
if (!php_amqp_is_valid_identifier(Z_STR_P(zdata))) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'vhost' exceeds %d character limit.",
PHP_AMQP_MAX_IDENTIFIER_LENGTH
);
return;
}
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("vhost"),
Z_STRVAL_P(zdata),
Z_STRLEN_P(zdata)
);
} else {
zend_update_property_string(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("vhost"),
INI_STR("amqp.vhost")
);
}
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("port"), INI_INT("amqp.port"));
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("port"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_long(zdata);
if (!php_amqp_is_valid_port(Z_LVAL_P(zdata))) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'port' must be a valid port number between %d and %d.",
PHP_AMQP_MIN_PORT,
PHP_AMQP_MAX_PORT
);
return;
}
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("port"), Z_LVAL_P(zdata));
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("readTimeout"),
INI_FLT("amqp.read_timeout")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("read_timeout"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_double(zdata);
if (!php_amqp_is_valid_timeout(Z_DVAL_P(zdata))) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'read_timeout' must be greater than or equal to zero.",
0
);
return;
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("readTimeout"),
Z_DVAL_P(zdata)
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("timeout"))) != NULL) {
/* 'read_timeout' takes precedence on 'timeout' but users have to know this */
php_error_docref(NULL, E_NOTICE, "Parameter 'timeout' is deprecated, 'read_timeout' used instead");
}
} else if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("timeout"))) != NULL) {
php_error_docref(NULL, E_DEPRECATED, "Parameter 'timeout' is deprecated; use 'read_timeout' instead");
SEPARATE_ZVAL(zdata);
convert_to_double(zdata);
if (!php_amqp_is_valid_timeout(Z_DVAL_P(zdata))) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'timeout' must be greater than or equal to zero.",
0
);
return;
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("readTimeout"),
Z_DVAL_P(zdata)
);
} else {
assert(DEFAULT_TIMEOUT != NULL);
if (strcmp(DEFAULT_TIMEOUT, INI_STR("amqp.timeout")) != 0) {
php_error_docref(
NULL,
E_DEPRECATED,
"INI setting 'amqp.timeout' is deprecated; use 'amqp.read_timeout' instead"
);
if (strcmp(DEFAULT_READ_TIMEOUT, INI_STR("amqp.read_timeout")) == 0) {
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("readTimeout"),
INI_FLT("amqp.timeout")
);
} else {
php_error_docref(
NULL,
E_NOTICE,
"INI setting 'amqp.read_timeout' will be used instead of 'amqp.timeout'"
);
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("readTimeout"),
INI_FLT("amqp.read_timeout")
);
}
} else {
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("readTimeout"),
INI_FLT("amqp.read_timeout")
);
}
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("writeTimeout"),
INI_FLT("amqp.write_timeout")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("write_timeout"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_double(zdata);
if (!php_amqp_is_valid_timeout(Z_DVAL_P(zdata))) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'write_timeout' must be greater than or equal to zero.",
0
);
return;
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("writeTimeout"),
Z_DVAL_P(zdata)
);
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("rpcTimeout"),
INI_FLT("amqp.rpc_timeout")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("rpc_timeout"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_double(zdata);
if (!php_amqp_is_valid_timeout(Z_DVAL_P(zdata))) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'rpc_timeout' must be greater than or equal to zero.",
0
);
- return;
+ RETURN_THROWS();
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("rpcTimeout"),
Z_DVAL_P(zdata)
);
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("connectTimeout"),
INI_FLT("amqp.connect_timeout")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("connect_timeout"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_double(zdata);
if (!php_amqp_is_valid_timeout(Z_DVAL_P(zdata))) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'connect_timeout' must be greater than or equal to zero.",
0
);
- return;
+ RETURN_THROWS();
}
zend_update_property_double(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("connectTimeout"),
Z_DVAL_P(zdata)
);
}
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("channelMax"),
INI_INT("amqp.channel_max")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("channel_max"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_long(zdata);
if (!php_amqp_is_valid_channel_max(Z_LVAL_P(zdata))) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'channel_max' is out of range.", 0);
- return;
+ RETURN_THROWS();
}
if (Z_LVAL_P(zdata) == 0) {
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("channelMax"),
PHP_AMQP_DEFAULT_CHANNEL_MAX
);
} else {
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("channelMax"),
Z_LVAL_P(zdata)
);
}
}
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("frameMax"),
INI_INT("amqp.frame_max")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("frame_max"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_long(zdata);
if (!php_amqp_is_valid_frame_size_max(Z_LVAL_P(zdata))) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'frame_max' is out of range.", 0);
- return;
+ RETURN_THROWS();
}
if (Z_LVAL_P(zdata) == 0) {
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("frameMax"),
PHP_AMQP_DEFAULT_FRAME_MAX
);
} else {
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("frameMax"),
Z_LVAL_P(zdata)
);
}
}
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("heartbeat"),
INI_INT("amqp.heartbeat")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("heartbeat"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_long(zdata);
if (!php_amqp_is_valid_heartbeat(Z_LVAL_P(zdata))) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'heartbeat' is out of range.", 0);
- return;
+ RETURN_THROWS();
}
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("heartbeat"), Z_LVAL_P(zdata));
}
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("saslMethod"),
INI_INT("amqp.sasl_method")
);
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("sasl_method"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_long(zdata);
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("saslMethod"), Z_LVAL_P(zdata));
}
PHP_AMQP_EXTRACT_CONNECTION_STR("cacert");
PHP_AMQP_EXTRACT_CONNECTION_STR("key");
PHP_AMQP_EXTRACT_CONNECTION_STR("cert");
PHP_AMQP_EXTRACT_CONNECTION_BOOL("verify");
/* Pull the connection_name out of the $params array */
zdata = NULL;
if (ini_arr && (zdata = zend_hash_str_find(HASH_OF(ini_arr), ZEND_STRL("connection_name"))) != NULL) {
SEPARATE_ZVAL(zdata);
convert_to_string(zdata);
}
if (zdata && Z_STRLEN_P(zdata) > 0) {
zend_update_property_string(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("connectionName"),
Z_STRVAL_P(zdata)
);
}
}
/* }}} */
/* {{{ proto amqp::isConnected()
check amqp connection */
static PHP_METHOD(amqp_connection_class, isConnected)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
RETURN_BOOL(connection->connection_resource != NULL && connection->connection_resource->is_connected);
}
/* }}} */
/* {{{ proto amqp::connect()
create amqp connection */
static PHP_METHOD(amqp_connection_class, connect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (connection->connection_resource->is_persistent) {
- php_error_docref(
- NULL,
- E_WARNING,
- "Attempt to start transient connection while persistent transient one already established. Continue."
+ zend_throw_exception(
+ amqp_connection_exception_class_entry,
+ "Attempt to start transient connection while persistent one already established. Continue.",
+ 0
);
}
- RETURN_TRUE;
+ return;
}
/* Actually connect this resource to the broker */
php_amqp_connect(connection, 0, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto amqp::connect()
create amqp connection */
static PHP_METHOD(amqp_connection_class, pconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
assert(connection->connection_resource != NULL);
if (!connection->connection_resource->is_persistent) {
- php_error_docref(
- NULL,
- E_WARNING,
- "Attempt to start persistent connection while transient one already established. Continue."
+ zend_throw_exception(
+ amqp_connection_exception_class_entry,
+ "Attempt to start persistent connection while transient one already established. Continue.",
+ 0
);
}
- RETURN_TRUE;
+ return;
}
/* Actually connect this resource to the broker or use stored connection */
php_amqp_connect(connection, 1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
#define PERSISTENT_TRANSIENT_EXCEPTION_MESSAGE \
"Attempted to %s a %s connection while a %s connection is established. Call '%s' instead"
/* {{{ proto amqp:pdisconnect()
destroy amqp persistent connection */
static PHP_METHOD(amqp_connection_class, pdisconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (!connection->connection_resource || !connection->connection_resource->is_connected) {
return;
}
assert(connection->connection_resource != NULL);
if (!connection->connection_resource->is_persistent) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
PERSISTENT_TRANSIENT_EXCEPTION_MESSAGE,
"close",
"persistent",
"transient",
"disconnect"
);
return;
}
php_amqp_disconnect_force(connection->connection_resource);
}
/* }}} */
/* {{{ proto amqp::disconnect()
destroy amqp connection */
static PHP_METHOD(amqp_connection_class, disconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (!connection->connection_resource || !connection->connection_resource->is_connected) {
return;
}
if (connection->connection_resource->is_persistent) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
PERSISTENT_TRANSIENT_EXCEPTION_MESSAGE,
"close",
"transient",
"persistent",
"pdisconnect"
);
return;
}
assert(connection->connection_resource != NULL);
php_amqp_disconnect(connection->connection_resource);
}
/* }}} */
/* {{{ proto amqp::reconnect()
recreate amqp connection */
static PHP_METHOD(amqp_connection_class, reconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
assert(connection->connection_resource != NULL);
if (connection->connection_resource->is_persistent) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
PERSISTENT_TRANSIENT_EXCEPTION_MESSAGE,
"reconnect",
"transient",
"persistent",
"preconnect"
);
return;
}
php_amqp_disconnect(connection->connection_resource);
}
php_amqp_connect(connection, 0, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto amqp::preconnect()
recreate amqp connection */
static PHP_METHOD(amqp_connection_class, preconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
assert(connection->connection_resource != NULL);
if (!connection->connection_resource->is_persistent) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
PERSISTENT_TRANSIENT_EXCEPTION_MESSAGE,
"reconnect",
"persistent",
"transient",
"reconnect"
);
return;
}
php_amqp_disconnect_force(connection->connection_resource);
}
php_amqp_connect(connection, 1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto amqp::getLogin()
get the login */
static PHP_METHOD(amqp_connection_class, getLogin)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("login");
}
/* }}} */
/* {{{ proto amqp::setLogin(string login)
set the login */
static PHP_METHOD(amqp_connection_class, setLogin)
{
char *login = NULL;
size_t login_len = 0;
/* Get the login from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &login, &login_len) == FAILURE) {
RETURN_THROWS();
}
/* Validate login length */
if (login_len > PHP_AMQP_MAX_CREDENTIALS_LENGTH) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'login' exceeds %d character limit.",
PHP_AMQP_MAX_CREDENTIALS_LENGTH
);
return;
}
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("login"), login, login_len);
}
/* }}} */
/* {{{ proto amqp::getPassword()
get the password */
static PHP_METHOD(amqp_connection_class, getPassword)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("password");
}
/* }}} */
/* {{{ proto amqp::setPassword(string password)
set the password */
static PHP_METHOD(amqp_connection_class, setPassword)
{
char *password = NULL;
size_t password_len = 0;
/* Get the password from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &password, &password_len) == FAILURE) {
RETURN_THROWS();
}
/* Validate password length */
if (password_len > PHP_AMQP_MAX_CREDENTIALS_LENGTH) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'password' exceeds %d character limit.",
PHP_AMQP_MAX_CREDENTIALS_LENGTH
);
return;
}
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("password"),
password,
password_len
);
}
/* }}} */
/* {{{ proto amqp::getHost()
get the host */
static PHP_METHOD(amqp_connection_class, getHost)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("host");
}
/* }}} */
/* {{{ proto amqp::setHost(string host)
set the host */
static PHP_METHOD(amqp_connection_class, setHost)
{
char *host = NULL;
size_t host_len = 0;
/* Get the host from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &host, &host_len) == FAILURE) {
RETURN_THROWS();
}
/* Validate host length */
if (host_len > PHP_AMQP_MAX_IDENTIFIER_LENGTH) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'host' exceeds %d character limit.",
PHP_AMQP_MAX_IDENTIFIER_LENGTH
);
return;
}
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("host"), host, host_len);
}
/* }}} */
/* {{{ proto amqp::getPort()
get the port */
static PHP_METHOD(amqp_connection_class, getPort)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("port");
}
/* }}} */
/* {{{ proto amqp::setPort(mixed port)
set the port */
static PHP_METHOD(amqp_connection_class, setPort)
{
zend_long port;
/* Get the port from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &port) == FAILURE) {
RETURN_THROWS();
}
/* Check the port value */
if (!php_amqp_is_valid_port(port)) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'port' must be a valid port number between %d and %d.",
PHP_AMQP_MIN_PORT,
PHP_AMQP_MAX_PORT
);
return;
}
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("port"), port);
}
/* }}} */
/* {{{ proto amqp::getVhost()
get the vhost */
static PHP_METHOD(amqp_connection_class, getVhost)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("vhost");
}
/* }}} */
/* {{{ proto amqp::setVhost(string vhost)
set the vhost */
static PHP_METHOD(amqp_connection_class, setVhost)
{
char *vhost = NULL;
size_t vhost_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &vhost, &vhost_len) == FAILURE) {
RETURN_THROWS();
}
/* Validate vhost length */
if (vhost_len > PHP_AMQP_MAX_IDENTIFIER_LENGTH) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Parameter 'vhost' exceeds %d characters limit.",
PHP_AMQP_MAX_IDENTIFIER_LENGTH
);
return;
}
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("vhost"), vhost, vhost_len);
}
/* }}} */
/* {{{ proto amqp::getTimeout()
@deprecated
get the timeout */
static PHP_METHOD(amqp_connection_class, getTimeout)
{
php_error_docref(
NULL,
E_DEPRECATED,
"AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead"
);
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("readTimeout");
}
/* }}} */
/* {{{ proto amqp::setTimeout(double timeout)
@deprecated
set the timeout */
static PHP_METHOD(amqp_connection_class, setTimeout)
{
amqp_connection_object *connection;
double read_timeout;
php_error_docref(
NULL,
E_DEPRECATED,
"AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) "
"instead"
);
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &read_timeout) == FAILURE) {
RETURN_THROWS();
}
/* Validate timeout */
if (!php_amqp_is_valid_timeout(read_timeout)) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'timeout' must be greater than or equal to zero.",
0
);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("readTimeout"), read_timeout);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_read_timeout(connection->connection_resource, read_timeout) == 0) {
php_amqp_disconnect_force(connection->connection_resource);
zend_throw_exception(amqp_connection_exception_class_entry, "Could not set read timeout", 0);
}
}
}
/* }}} */
/* {{{ proto amqp::getReadTimeout()
get the read timeout */
static PHP_METHOD(amqp_connection_class, getReadTimeout)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("readTimeout");
}
/* }}} */
/* {{{ proto amqp::setReadTimeout(double timeout)
set read timeout */
static PHP_METHOD(amqp_connection_class, setReadTimeout)
{
amqp_connection_object *connection;
double read_timeout;
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &read_timeout) == FAILURE) {
RETURN_THROWS();
}
/* Validate timeout */
if (!php_amqp_is_valid_timeout(read_timeout)) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'readTimeout' must be greater than or equal to zero.",
0
);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("readTimeout"), read_timeout);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_read_timeout(connection->connection_resource, read_timeout) == 0) {
php_amqp_disconnect_force(connection->connection_resource);
zend_throw_exception(amqp_connection_exception_class_entry, "Could not set read timeout", 0);
}
}
}
/* }}} */
/* {{{ proto amqp::getWriteTimeout()
get write timeout */
static PHP_METHOD(amqp_connection_class, getWriteTimeout)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("writeTimeout");
}
/* }}} */
/* {{{ proto amqp::setWriteTimeout(double timeout)
set write timeout */
static PHP_METHOD(amqp_connection_class, setWriteTimeout)
{
amqp_connection_object *connection;
double write_timeout;
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &write_timeout) == FAILURE) {
RETURN_THROWS();
}
/* Validate timeout */
if (!php_amqp_is_valid_timeout(write_timeout)) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'writeTimeout' must be greater than or equal to zero.",
0
);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("writeTimeout"), write_timeout);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_write_timeout(connection->connection_resource, write_timeout) == 0) {
php_amqp_disconnect_force(connection->connection_resource);
zend_throw_exception(amqp_connection_exception_class_entry, "Could not set write timeout", 0);
}
}
}
/* }}} */
/* {{{ proto amqp::getRpcTimeout()
get rpc timeout */
static PHP_METHOD(amqp_connection_class, getConnectTimeout)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("connectTimeout");
}
/* }}} */
/* {{{ proto amqp::getRpcTimeout()
get rpc timeout */
static PHP_METHOD(amqp_connection_class, getRpcTimeout)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("rpcTimeout");
}
/* }}} */
/* {{{ proto amqp::setRpcTimeout(double timeout)
set rpc timeout */
static PHP_METHOD(amqp_connection_class, setRpcTimeout)
{
amqp_connection_object *connection;
double rpc_timeout;
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &rpc_timeout) == FAILURE) {
RETURN_THROWS();
}
/* Validate timeout */
if (!php_amqp_is_valid_timeout(rpc_timeout)) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Parameter 'rpcTimeout' must be greater than or equal to zero.",
0
);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("rpcTimeout"), rpc_timeout);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_rpc_timeout(connection->connection_resource, rpc_timeout) == 0) {
php_amqp_disconnect_force(connection->connection_resource);
zend_throw_exception(amqp_connection_exception_class_entry, "Could not set connect timeout", 0);
}
}
}
/* }}} */
/* {{{ proto amqp::getUsedChannels()
Get max used channels number */
static PHP_METHOD(amqp_connection_class, getUsedChannels)
{
amqp_connection_object *connection;
/* Get the timeout from the method params */
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (!connection->connection_resource || !connection->connection_resource->is_connected) {
php_error_docref(NULL, E_WARNING, "Connection is not connected.");
RETURN_LONG(0);
}
RETURN_LONG(connection->connection_resource->used_slots);
}
/* }}} */
/* {{{ proto amqp::getMaxChannels()
Get max supported channels number per connection */
PHP_METHOD(amqp_connection_class, getMaxChannels)
{
zval rv;
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
RETURN_LONG(connection->connection_resource->max_slots);
}
PHP_AMQP_RETURN_THIS_PROP("channelMax");
}
/* }}} */
/* {{{ proto amqp::getMaxFrameSize()
Get max supported frame size per connection in bytes */
static PHP_METHOD(amqp_connection_class, getMaxFrameSize)
{
zval rv;
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
RETURN_LONG(amqp_get_frame_max(connection->connection_resource->connection_state));
}
PHP_AMQP_RETURN_THIS_PROP("frameMax");
}
/* }}} */
/* {{{ proto amqp::getHeartbeatInterval()
Get number of seconds between heartbeats of the connection in seconds */
static PHP_METHOD(amqp_connection_class, getHeartbeatInterval)
{
zval rv;
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource != NULL && connection->connection_resource->is_connected != '\0') {
RETURN_LONG(amqp_get_heartbeat(connection->connection_resource->connection_state));
}
PHP_AMQP_RETURN_THIS_PROP("heartbeat");
}
/* }}} */
/* {{{ proto amqp::isPersistent()
check whether amqp connection is persistent */
static PHP_METHOD(amqp_connection_class, isPersistent)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS()
connection = PHP_AMQP_GET_CONNECTION(getThis());
RETURN_BOOL(connection->connection_resource && connection->connection_resource->is_persistent);
}
/* }}} */
/* {{{ proto amqp::getCACert() */
static PHP_METHOD(amqp_connection_class, getCACert)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("cacert");
}
/* }}} */
/* {{{ proto amqp::setCACert(string cacert) */
static PHP_METHOD(amqp_connection_class, setCACert)
{
char *str = NULL;
size_t str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &str, &str_len) == FAILURE) {
RETURN_THROWS();
}
if (str == NULL) {
zend_update_property_null(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("cacert"));
} else {
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("cacert"), str, str_len);
}
}
/* }}} */
/* {{{ proto amqp::getCert() */
static PHP_METHOD(amqp_connection_class, getCert)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("cert");
}
/* }}} */
/* {{{ proto amqp::setCert(string cert) */
static PHP_METHOD(amqp_connection_class, setCert)
{
char *str = NULL;
size_t str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &str, &str_len) == FAILURE) {
RETURN_THROWS();
}
if (str == NULL) {
zend_update_property_null(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("cert"));
} else {
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("cert"), str, str_len);
}
}
/* }}} */
/* {{{ proto amqp::getKey() */
static PHP_METHOD(amqp_connection_class, getKey)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("key");
}
/* }}} */
/* {{{ proto amqp::setKey(string key) */
static PHP_METHOD(amqp_connection_class, setKey)
{
char *str = NULL;
size_t str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &str, &str_len) == FAILURE) {
RETURN_THROWS();
}
if (str == NULL) {
zend_update_property_null(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("key"));
} else {
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("key"), str, str_len);
}
}
/* }}} */
/* {{{ proto amqp::getVerify() */
static PHP_METHOD(amqp_connection_class, getVerify)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("verify");
}
/* }}} */
/* {{{ proto amqp::setVerify(bool verify) */
static PHP_METHOD(amqp_connection_class, setVerify)
{
bool verify = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &verify) == FAILURE) {
RETURN_THROWS();
}
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("verify"), verify);
}
/* }}} */
/* {{{ proto amqp::getSaslMethod()
get sasl method */
static PHP_METHOD(amqp_connection_class, getSaslMethod)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("saslMethod");
}
/* }}} */
/* {{{ proto amqp::setSaslMethod(mixed method)
set sasl method */
static PHP_METHOD(amqp_connection_class, setSaslMethod)
{
long method;
/* Get the port from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
RETURN_THROWS();
}
/* Check the method value */
if (method != AMQP_SASL_METHOD_PLAIN && method != AMQP_SASL_METHOD_EXTERNAL) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Invalid SASL method given. Method must be AMQP_SASL_METHOD_PLAIN or AMQP_SASL_METHOD_EXTERNAL.",
0
);
return;
}
zend_update_property_long(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("saslMethod"), method);
}
/* }}} */
/* {{{ proto amqp::getConnectionName() */
static PHP_METHOD(amqp_connection_class, getConnectionName)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("connectionName");
}
/* }}} */
/* {{{ proto amqp::setConnectionName(string connectionName) */
static PHP_METHOD(amqp_connection_class, setConnectionName)
{
char *str = NULL;
size_t str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &str, &str_len) == FAILURE) {
RETURN_THROWS();
}
if (str == NULL) {
zend_update_property_null(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("connectionName"));
} else {
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("connectionName"),
str,
str_len
);
}
}
/* }}} */
/* amqp_connection_class ARG_INFO definition */
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class__construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, credentials, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_isConnected, ZEND_SEND_BY_VAL, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_connect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_pconnect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_pdisconnect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_disconnect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_reconnect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_preconnect, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getLogin, ZEND_SEND_BY_VAL, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setLogin, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, login, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getPassword, ZEND_SEND_BY_VAL, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setPassword, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getHost, ZEND_SEND_BY_VAL, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setHost, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getPort, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setPort, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getVhost, ZEND_SEND_BY_VAL, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setVhost, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, vhost, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getTimeout, ZEND_SEND_BY_VAL, 0, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setTimeout, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getReadTimeout, ZEND_SEND_BY_VAL, 0, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setReadTimeout, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_connection_class_getWriteTimeout,
ZEND_SEND_BY_VAL,
0,
IS_DOUBLE,
0
)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setWriteTimeout, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_connection_class_getConnectTimeout,
ZEND_SEND_BY_VAL,
0,
IS_DOUBLE,
0
)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getRpcTimeout, ZEND_SEND_BY_VAL, 0, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setRpcTimeout, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getUsedChannels, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getMaxChannels, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getMaxFrameSize, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_connection_class_getHeartbeatInterval,
ZEND_SEND_BY_VAL,
0,
IS_LONG,
0
)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_isPersistent, ZEND_SEND_BY_VAL, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getCACert, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setCACert, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, cacert, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getCert, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setCert, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, cert, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getKey, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setKey, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getVerify, ZEND_SEND_BY_VAL, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setVerify, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, verify, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_getSaslMethod, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_connection_class_setSaslMethod, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, saslMethod, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_connection_class_getConnectionName,
ZEND_SEND_BY_VAL,
0,
IS_STRING,
1
)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(
arginfo_amqp_connection_class_setConnectionName,
ZEND_SEND_BY_VAL,
1,
IS_VOID,
0
)
ZEND_ARG_TYPE_INFO(0, connectionName, IS_STRING, 1)
ZEND_END_ARG_INFO()
zend_function_entry amqp_connection_class_functions[] = {
PHP_ME(amqp_connection_class, __construct, arginfo_amqp_connection_class__construct, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, isConnected, arginfo_amqp_connection_class_isConnected, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, connect, arginfo_amqp_connection_class_connect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, pconnect, arginfo_amqp_connection_class_pconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, pdisconnect, arginfo_amqp_connection_class_pdisconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, disconnect, arginfo_amqp_connection_class_disconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, reconnect, arginfo_amqp_connection_class_reconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, preconnect, arginfo_amqp_connection_class_preconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getLogin, arginfo_amqp_connection_class_getLogin, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setLogin, arginfo_amqp_connection_class_setLogin, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getPassword, arginfo_amqp_connection_class_getPassword, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setPassword, arginfo_amqp_connection_class_setPassword, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getHost, arginfo_amqp_connection_class_getHost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setHost, arginfo_amqp_connection_class_setHost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getPort, arginfo_amqp_connection_class_getPort, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setPort, arginfo_amqp_connection_class_setPort, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getVhost, arginfo_amqp_connection_class_getVhost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setVhost, arginfo_amqp_connection_class_setVhost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getTimeout, arginfo_amqp_connection_class_getTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setTimeout, arginfo_amqp_connection_class_setTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getReadTimeout, arginfo_amqp_connection_class_getReadTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setReadTimeout, arginfo_amqp_connection_class_setReadTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getWriteTimeout, arginfo_amqp_connection_class_getWriteTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setWriteTimeout, arginfo_amqp_connection_class_setWriteTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getConnectTimeout, arginfo_amqp_connection_class_getConnectTimeout, ZEND_ACC_PUBLIC)
/** setConnectTimeout intentionally left out */
PHP_ME(amqp_connection_class, getRpcTimeout, arginfo_amqp_connection_class_getRpcTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setRpcTimeout, arginfo_amqp_connection_class_setRpcTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getUsedChannels, arginfo_amqp_connection_class_getUsedChannels, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getMaxChannels, arginfo_amqp_connection_class_getMaxChannels, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, isPersistent, arginfo_amqp_connection_class_isPersistent, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getHeartbeatInterval, arginfo_amqp_connection_class_getHeartbeatInterval, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getMaxFrameSize, arginfo_amqp_connection_class_getMaxFrameSize, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getCACert, arginfo_amqp_connection_class_getCACert, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setCACert, arginfo_amqp_connection_class_setCACert, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getCert, arginfo_amqp_connection_class_getCert, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setCert, arginfo_amqp_connection_class_setCert, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getKey, arginfo_amqp_connection_class_getKey, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setKey, arginfo_amqp_connection_class_setKey, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getVerify, arginfo_amqp_connection_class_getVerify, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setVerify, arginfo_amqp_connection_class_setVerify, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getSaslMethod, arginfo_amqp_connection_class_getSaslMethod, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setSaslMethod, arginfo_amqp_connection_class_setSaslMethod, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getConnectionName, arginfo_amqp_connection_class_getConnectionName, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setConnectionName, arginfo_amqp_connection_class_setConnectionName, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
PHP_MINIT_FUNCTION(amqp_connection)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "AMQPConnection", amqp_connection_class_functions);
ce.create_object = amqp_connection_ctor;
this_ce = zend_register_internal_class(&ce);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "login", ZEND_ACC_PRIVATE, IS_STRING, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "password", ZEND_ACC_PRIVATE, IS_STRING, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "host", ZEND_ACC_PRIVATE, IS_STRING, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "vhost", ZEND_ACC_PRIVATE, IS_STRING, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "port", ZEND_ACC_PRIVATE, IS_LONG, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "readTimeout", ZEND_ACC_PRIVATE, IS_DOUBLE, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "writeTimeout", ZEND_ACC_PRIVATE, IS_DOUBLE, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "connectTimeout", ZEND_ACC_PRIVATE, IS_DOUBLE, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "rpcTimeout", ZEND_ACC_PRIVATE, IS_DOUBLE, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "frameMax", ZEND_ACC_PRIVATE, IS_LONG, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "channelMax", ZEND_ACC_PRIVATE, IS_LONG, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "heartbeat", ZEND_ACC_PRIVATE, IS_LONG, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "cacert", ZEND_ACC_PRIVATE, IS_STRING, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "key", ZEND_ACC_PRIVATE, IS_STRING, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "cert", ZEND_ACC_PRIVATE, IS_STRING, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "verify", ZEND_ACC_PRIVATE, _IS_BOOL, 0, ZVAL_TRUE);
zval default_sasl_method;
ZVAL_LONG(&default_sasl_method, DEFAULT_SASL_METHOD);
PHP_AMQP_DECLARE_TYPED_PROPERTY_ZVAL(
this_ce,
"saslMethod",
ZEND_ACC_PRIVATE,
PHP_AMQP_DECLARE_PROPERTY_TYPE(IS_LONG, 0),
default_sasl_method
);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "connectionName", ZEND_ACC_PRIVATE, IS_STRING, 1);
memcpy(&amqp_connection_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
amqp_connection_object_handlers.offset = XtOffsetOf(amqp_connection_object, zo);
amqp_connection_object_handlers.free_obj = amqp_connection_free;
return SUCCESS;
}
diff --git a/amqp-2.1.0/amqp_connection.h b/amqp-2.1.1/amqp_connection.h
similarity index 100%
rename from amqp-2.1.0/amqp_connection.h
rename to amqp-2.1.1/amqp_connection.h
diff --git a/amqp-2.1.0/amqp_connection_resource.c b/amqp-2.1.1/amqp_connection_resource.c
similarity index 99%
rename from amqp-2.1.0/amqp_connection_resource.c
rename to amqp-2.1.1/amqp_connection_resource.c
index 4a894fe..56194da 100644
--- a/amqp-2.1.0/amqp_connection_resource.c
+++ b/amqp-2.1.1/amqp_connection_resource.c
@@ -1,760 +1,758 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "ext/standard/datetime.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
#if PHP_VERSION_ID >= 80000
#include <stdint.h>
#else
#include "win32/php_stdint.h"
#endif
#include "win32/signal.h"
#else
#include <signal.h>
#include <stdint.h>
#endif
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#include <rabbitmq-c/framing.h>
#include <rabbitmq-c/tcp_socket.h>
#include <rabbitmq-c/ssl_socket.h>
#else
#include <amqp.h>
#include <amqp_framing.h>
#include <amqp_tcp_socket.h>
#include <amqp_ssl_socket.h>
#endif
#ifdef PHP_WIN32
#include "win32/unistd.h"
#else
#include <unistd.h>
#endif
#include "amqp_methods_handling.h"
#include "amqp_connection_resource.h"
#include "amqp_channel.h"
#include "php_amqp.h"
#ifndef E_DEPRECATED
#define E_DEPRECATED E_WARNING
#endif
int le_amqp_connection_resource;
int le_amqp_connection_resource_persistent;
static void connection_resource_destructor(amqp_connection_resource *resource, int persistent);
static void php_amqp_close_connection_from_server(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *resource
);
static void php_amqp_close_channel_from_server(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *resource,
amqp_channel_t channel_id
);
/* Figure out what's going on connection and handle protocol exceptions, if any */
int php_amqp_connection_resource_error(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *resource,
amqp_channel_t channel_id
)
{
assert(resource != NULL);
switch (reply.reply_type) {
case AMQP_RESPONSE_NORMAL:
return PHP_AMQP_RESOURCE_RESPONSE_OK;
case AMQP_RESPONSE_NONE:
spprintf(message, 0, "Missing RPC reply type.");
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
case AMQP_RESPONSE_LIBRARY_EXCEPTION:
spprintf(message, 0, "%s", amqp_error_string2(reply.library_error));
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
case AMQP_RESPONSE_SERVER_EXCEPTION:
switch (reply.reply.id) {
case AMQP_CONNECTION_CLOSE_METHOD: {
php_amqp_close_connection_from_server(reply, message, resource);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED;
}
case AMQP_CHANNEL_CLOSE_METHOD: {
php_amqp_close_channel_from_server(reply, message, resource, channel_id);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CHANNEL_CLOSED;
}
}
/* Default for the above switch should be handled by the below default. */
default:
spprintf(message, 0, "Unknown server error, method id 0x%08X", reply.reply.id);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
}
/* Should not never get here*/
}
static void php_amqp_close_connection_from_server(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *resource
)
{
amqp_connection_close_t *m = (amqp_connection_close_t *) reply.reply.decoded;
int result;
if (!reply.reply.id) {
PHP_AMQP_G(error_code) = -1;
spprintf(
message,
0,
"Server connection error: %ld, message: %s",
(long) PHP_AMQP_G(error_code),
"unexpected response"
);
} else {
PHP_AMQP_G(error_code) = m->reply_code;
spprintf(
message,
0,
"Server connection error: %d, message: %.*s",
m->reply_code,
(int) m->reply_text.len,
(char *) m->reply_text.bytes
);
}
/*
* - If r.reply.id == AMQP_CONNECTION_CLOSE_METHOD a connection exception
* occurred, cast r.reply.decoded to amqp_connection_close_t* to see
* details of the exception. The client amqp_send_method() a
* amqp_connection_close_ok_t and disconnect from the broker.
*/
amqp_connection_close_ok_t *decoded = (amqp_connection_close_ok_t *) NULL;
result = amqp_send_method(
resource->connection_state,
0, /* NOTE: 0-channel is reserved for things like this */
AMQP_CONNECTION_CLOSE_OK_METHOD,
&decoded
);
if (result != AMQP_STATUS_OK) {
zend_throw_exception(amqp_channel_exception_class_entry, "An error occurred while closing the connection.", 0);
}
/* Prevent finishing AMQP connection in connection resource destructor */
resource->is_connected = '\0';
}
static void php_amqp_close_channel_from_server(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *resource,
amqp_channel_t channel_id
)
{
assert(channel_id > 0 && channel_id <= resource->max_slots);
amqp_channel_close_t *m = (amqp_channel_close_t *) reply.reply.decoded;
if (!reply.reply.id) {
PHP_AMQP_G(error_code) = -1;
spprintf(
message,
0,
"Server channel error: %ld, message: %s",
(long) PHP_AMQP_G(error_code),
"unexpected response"
);
} else {
PHP_AMQP_G(error_code) = m->reply_code;
spprintf(
message,
0,
"Server channel error: %d, message: %.*s",
m->reply_code,
(int) m->reply_text.len,
(char *) m->reply_text.bytes
);
}
/*
* - If r.reply.id == AMQP_CHANNEL_CLOSE_METHOD a channel exception
* occurred, cast r.reply.decoded to amqp_channel_close_t* to see details
* of the exception. The client should amqp_send_method() a
* amqp_channel_close_ok_t. The channel must be re-opened before it
* can be used again. Any resources associated with the channel
* (auto-delete exchanges, auto-delete queues, consumers) are invalid
* and must be recreated before attempting to use them again.
*/
if (resource) {
int result;
amqp_channel_close_ok_t *decoded = (amqp_channel_close_ok_t *) NULL;
result = amqp_send_method(resource->connection_state, channel_id, AMQP_CHANNEL_CLOSE_OK_METHOD, &decoded);
if (result != AMQP_STATUS_OK) {
zend_throw_exception(amqp_channel_exception_class_entry, "An error occurred while closing channel.", 0);
}
}
}
int php_amqp_connection_resource_error_advanced(amqp_rpc_reply_t reply, char **message, amqp_channel_object *channel)
{
- assert(resource != NULL);
-
amqp_frame_t frame;
assert(AMQP_RESPONSE_LIBRARY_EXCEPTION == reply.reply_type);
assert(AMQP_STATUS_UNEXPECTED_STATE == reply.library_error);
if (channel->channel_resource->channel_id < 0 ||
AMQP_STATUS_OK !=
amqp_simple_wait_frame(channel->channel_resource->connection_resource->connection_state, &frame)) {
if (*message != NULL) {
efree(*message);
}
spprintf(message, 0, "%s", amqp_error_string2(reply.library_error));
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
}
if (channel->channel_resource->channel_id != frame.channel) {
spprintf(message, 0, "Channel mismatch");
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
}
if (AMQP_FRAME_METHOD == frame.frame_type) {
switch (frame.payload.method.id) {
case AMQP_CONNECTION_CLOSE_METHOD: {
php_amqp_close_connection_from_server(reply, message, channel->channel_resource->connection_resource);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED;
}
case AMQP_CHANNEL_CLOSE_METHOD: {
php_amqp_close_channel_from_server(
reply,
message,
channel->channel_resource->connection_resource,
channel->channel_resource->channel_id
);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CHANNEL_CLOSED;
}
case AMQP_BASIC_ACK_METHOD:
/* if we've turned publisher confirms on, and we've published a message
* here is a message being confirmed
*/
return php_amqp_handle_basic_ack(message, channel, &frame.payload.method);
case AMQP_BASIC_NACK_METHOD:
/* if we've turned publisher confirms on, and we've published a message
* here is a message being confirmed
*/
return php_amqp_handle_basic_nack(message, channel, &frame.payload.method);
case AMQP_BASIC_RETURN_METHOD:
/* if a published message couldn't be routed and the mandatory flag was set
* this is what would be returned. The message then needs to be read.
*/
return php_amqp_handle_basic_return(message, channel, &frame.payload.method);
default:
if (*message != NULL) {
efree(*message);
}
spprintf(message, 0, "An unexpected method was received 0x%08X\n", frame.payload.method.id);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
}
}
if (*message != NULL) {
efree(*message);
}
spprintf(message, 0, "%s", amqp_error_string2(reply.library_error));
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
}
/* Socket-related functions */
int php_amqp_set_resource_read_timeout(amqp_connection_resource *resource, double timeout)
{
assert(timeout >= 0.0);
#ifdef PHP_WIN32
DWORD read_timeout;
/*
In Windows, setsockopt with SO_RCVTIMEO sets actual timeout
to a value that's 500ms greater than specified value.
Also, it's not possible to set timeout to any value below 500ms.
Zero timeout works like it should, however.
*/
if (timeout == 0.) {
read_timeout = 0;
} else {
read_timeout = (int) (max(timeout * 1.e+3 - .5e+3, 1.));
}
#else
struct timeval read_timeout;
read_timeout.tv_sec = (int) floor(timeout);
read_timeout.tv_usec = (int) ((timeout - floor(timeout)) * 1.e+6);
#endif
if (0 != setsockopt(
amqp_get_sockfd(resource->connection_state),
SOL_SOCKET,
SO_RCVTIMEO,
(char *) &read_timeout,
sizeof(read_timeout)
)) {
zend_throw_exception(amqp_connection_exception_class_entry, "Socket error: cannot setsockopt SO_RCVTIMEO", 0);
return 0;
}
return 1;
}
int php_amqp_set_resource_rpc_timeout(amqp_connection_resource *resource, double timeout)
{
assert(timeout >= 0.0);
#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH >= 90
struct timeval rpc_timeout;
if (timeout == 0.)
return 1;
rpc_timeout.tv_sec = (int) floor(timeout);
rpc_timeout.tv_usec = (int) ((timeout - floor(timeout)) * 1.e+6);
if (AMQP_STATUS_OK != amqp_set_rpc_timeout(resource->connection_state, &rpc_timeout)) {
zend_throw_exception(amqp_connection_exception_class_entry, "Cannot set rpc_timeout", 0);
return 0;
}
#endif
return 1;
}
int php_amqp_set_resource_write_timeout(amqp_connection_resource *resource, double timeout)
{
assert(timeout >= 0.0);
#ifdef PHP_WIN32
DWORD write_timeout;
if (timeout == 0.) {
write_timeout = 0;
} else {
write_timeout = (int) (max(timeout * 1.e+3 - .5e+3, 1.));
}
#else
struct timeval write_timeout;
write_timeout.tv_sec = (int) floor(timeout);
write_timeout.tv_usec = (int) ((timeout - floor(timeout)) * 1.e+6);
#endif
if (0 != setsockopt(
amqp_get_sockfd(resource->connection_state),
SOL_SOCKET,
SO_SNDTIMEO,
(char *) &write_timeout,
sizeof(write_timeout)
)) {
zend_throw_exception(amqp_connection_exception_class_entry, "Socket error: cannot setsockopt SO_SNDTIMEO", 0);
return 0;
}
return 1;
}
/* Channel-related functions */
amqp_channel_t php_amqp_connection_resource_get_available_channel_id(amqp_connection_resource *resource)
{
assert(resource != NULL);
assert(resource->slots != NULL);
/* Check if there are any open slots */
if (resource->used_slots >= resource->max_slots) {
return 0;
}
amqp_channel_t slot;
for (slot = resource->used_slots; slot < resource->max_slots; slot++) {
if (resource->slots[slot] == 0) {
return (amqp_channel_t) (slot + 1);
}
}
return 0;
}
int php_amqp_connection_resource_register_channel(
amqp_connection_resource *resource,
amqp_channel_resource *channel_resource,
amqp_channel_t channel_id
)
{
assert(resource != NULL);
assert(resource->slots != NULL);
assert(channel_id > 0 && channel_id <= resource->max_slots);
if (resource->slots[channel_id - 1] != 0) {
return FAILURE;
}
resource->slots[channel_id - 1] = channel_resource;
channel_resource->connection_resource = resource;
resource->used_slots++;
return SUCCESS;
}
int php_amqp_connection_resource_unregister_channel(amqp_connection_resource *resource, amqp_channel_t channel_id)
{
assert(resource != NULL);
assert(resource->slots != NULL);
assert(channel_id > 0 && channel_id <= resource->max_slots);
if (resource->slots[channel_id - 1] != 0) {
resource->slots[channel_id - 1]->connection_resource = NULL;
resource->slots[channel_id - 1] = 0;
resource->used_slots--;
}
return SUCCESS;
}
/* Creating and destroying resource */
amqp_connection_resource *connection_resource_constructor(amqp_connection_params *params, bool persistent)
{
struct timeval tv = {0};
struct timeval *tv_ptr = &tv;
char *std_datetime;
amqp_table_entry_t client_properties_entries[4];
amqp_table_t client_properties_table;
amqp_table_entry_t custom_properties_entries[2];
amqp_table_t custom_properties_table;
amqp_connection_resource *resource;
/* Allocate space for the connection resource */
resource = (amqp_connection_resource *) pecalloc(1, sizeof(amqp_connection_resource), persistent);
/* Create the connection */
resource->connection_state = amqp_new_connection();
/* Create socket object */
if (params->cacert) {
resource->socket = amqp_ssl_socket_new(resource->connection_state);
if (!resource->socket) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Socket error: could not create SSL socket.",
0
);
return NULL;
}
if (amqp_ssl_socket_set_cacert(resource->socket, params->cacert) != AMQP_STATUS_OK) {
zend_throw_exception(
amqp_connection_exception_class_entry,
"Socket error: could not set CA certificate.",
0
);
connection_resource_destructor(resource, persistent);
return NULL;
}
#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH >= 80
amqp_ssl_socket_set_verify_peer(resource->socket, params->verify);
amqp_ssl_socket_set_verify_hostname(resource->socket, params->verify);
#else
amqp_ssl_socket_set_verify(resource->socket, params->verify);
#endif
if (params->cert && params->key) {
int client_cert_result = amqp_ssl_socket_set_key(resource->socket, params->cert, params->key);
if (client_cert_result != AMQP_STATUS_OK) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Socket error: could not set client cert, %s",
amqp_error_string2(client_cert_result)
);
connection_resource_destructor(resource, persistent);
return NULL;
}
}
} else {
resource->socket = amqp_tcp_socket_new(resource->connection_state);
if (!resource->socket) {
zend_throw_exception(amqp_connection_exception_class_entry, "Socket error: could not create socket.", 0);
return NULL;
}
}
if (params->connect_timeout > 0) {
tv.tv_sec = (long int) params->connect_timeout;
tv.tv_usec = (long int) ((params->connect_timeout - tv.tv_sec) * 1000000);
} else {
tv_ptr = NULL;
}
/* Try to connect and verify that no error occurred */
int connection_result = amqp_socket_open_noblock(resource->socket, params->host, params->port, tv_ptr);
if (connection_result != AMQP_STATUS_OK) {
zend_throw_exception_ex(
amqp_connection_exception_class_entry,
0,
"Socket error: could not connect to host, %s",
amqp_error_string2(connection_result)
);
connection_resource_destructor(resource, persistent);
return NULL;
}
if (!php_amqp_set_resource_read_timeout(resource, params->read_timeout)) {
connection_resource_destructor(resource, persistent);
return NULL;
}
if (!php_amqp_set_resource_write_timeout(resource, params->write_timeout)) {
connection_resource_destructor(resource, persistent);
return NULL;
}
if (!php_amqp_set_resource_rpc_timeout(resource, params->rpc_timeout)) {
connection_resource_destructor(resource, persistent);
return NULL;
}
std_datetime = php_std_date(time(NULL));
client_properties_entries[0].key = amqp_cstring_bytes("type");
client_properties_entries[0].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[0].value.value.bytes = amqp_cstring_bytes("php-amqp extension");
client_properties_entries[1].key = amqp_cstring_bytes("version");
client_properties_entries[1].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[1].value.value.bytes = amqp_cstring_bytes(PHP_AMQP_VERSION);
client_properties_entries[2].key = amqp_cstring_bytes("connection type");
client_properties_entries[2].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[2].value.value.bytes = amqp_cstring_bytes(persistent ? "persistent" : "transient");
client_properties_entries[3].key = amqp_cstring_bytes("connection started");
client_properties_entries[3].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[3].value.value.bytes = amqp_cstring_bytes(std_datetime);
client_properties_table.entries = client_properties_entries;
client_properties_table.num_entries = sizeof(client_properties_entries) / sizeof(amqp_table_entry_t);
custom_properties_entries[0].key = amqp_cstring_bytes("client");
custom_properties_entries[0].value.kind = AMQP_FIELD_KIND_TABLE;
custom_properties_entries[0].value.value.table = client_properties_table;
if (params->connection_name) {
custom_properties_entries[1].key = amqp_cstring_bytes("connection_name");
custom_properties_entries[1].value.kind = AMQP_FIELD_KIND_UTF8;
custom_properties_entries[1].value.value.bytes = amqp_cstring_bytes(params->connection_name);
}
custom_properties_table.entries = custom_properties_entries;
custom_properties_table.num_entries = params->connection_name ? 2 : 1;
/* We can assume that connection established here but it is not true, real handshake goes during login */
assert(params->frame_max > 0);
amqp_rpc_reply_t res = amqp_login_with_properties(
resource->connection_state,
params->vhost,
params->channel_max,
params->frame_max,
params->heartbeat,
&custom_properties_table,
params->sasl_method,
params->login,
params->password
);
efree(std_datetime);
if (AMQP_RESPONSE_NORMAL != res.reply_type) {
char *message = NULL, *long_message = NULL;
php_amqp_connection_resource_error(res, &message, resource, 0);
spprintf(&long_message, 0, "%s", message);
zend_throw_exception(amqp_connection_exception_class_entry, long_message, PHP_AMQP_G(error_code));
efree(message);
efree(long_message);
/* https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf
*
* 2.2.4 The Connection Class:
* ... a peer that detects an error MUST close the socket without sending any further data.
*
* 4.10.2 Denial of Service Attacks:
* ... The general response to any exceptional condition in the connection negotiation is to pause that connection
* (presumably a thread) for a period of several seconds and then to close the network connection. This
* includes syntax errors, over-sized data, and failed attempts to authenticate.
*/
connection_resource_destructor(resource, persistent);
return NULL;
}
/* Allocate space for the channel slots in the ring buffer */
resource->max_slots = (amqp_channel_t) amqp_get_channel_max(resource->connection_state);
assert(resource->max_slots > 0);
resource->slots =
(amqp_channel_resource **) pecalloc(resource->max_slots + 1, sizeof(amqp_channel_object *), persistent);
resource->is_connected = '\1';
return resource;
}
ZEND_RSRC_DTOR_FUNC(amqp_connection_resource_dtor_persistent)
{
amqp_connection_resource *resource = (amqp_connection_resource *) res->ptr;
connection_resource_destructor(resource, 1);
}
ZEND_RSRC_DTOR_FUNC(amqp_connection_resource_dtor)
{
amqp_connection_resource *resource = (amqp_connection_resource *) res->ptr;
connection_resource_destructor(resource, 0);
}
static void connection_resource_destructor(amqp_connection_resource *resource, int persistent)
{
assert(resource != NULL);
#ifndef PHP_WIN32
void *old_handler;
/*
If we are trying to close the connection and the connection already closed, it will throw
SIGPIPE, which is fine, so ignore all SIGPIPES
*/
/* Start ignoring SIGPIPE */
old_handler = signal(SIGPIPE, SIG_IGN);
#endif
if (resource->parent) {
resource->parent->connection_resource = NULL;
}
if (resource->slots) {
php_amqp_prepare_for_disconnect(resource);
pefree(resource->slots, persistent);
resource->slots = NULL;
}
/* connection may be closed in case of previous failure */
if (resource->is_connected) {
amqp_connection_close(resource->connection_state, AMQP_REPLY_SUCCESS);
}
amqp_destroy_connection(resource->connection_state);
#ifndef PHP_WIN32
/* End ignoring of SIGPIPEs */
signal(SIGPIPE, old_handler);
#endif
pefree(resource, persistent);
}
void php_amqp_prepare_for_disconnect(amqp_connection_resource *resource)
{
if (resource == NULL) {
return;
}
if (resource->slots != NULL) {
/* NOTE: when we have persistent connection we do not move channels between php requests
* due to current php-amqp extension limitation in AMQPChannel where __construct == channel.open AMQP method call
* and __destruct = channel.close AMQP method call
*/
/* Clean up old memory allocations which are now invalid (new connection) */
amqp_channel_t slot;
for (slot = 0; slot < resource->max_slots; slot++) {
if (resource->slots[slot] != 0) {
php_amqp_close_channel(resource->slots[slot], 0);
}
}
}
/* If it's persistent connection do not destroy connection resource (this keep connection alive) */
if (resource->is_persistent) {
/* Cleanup buffers to reduce memory usage in idle mode */
amqp_maybe_release_buffers(resource->connection_state);
}
return;
}
diff --git a/amqp-2.1.0/amqp_connection_resource.h b/amqp-2.1.1/amqp_connection_resource.h
similarity index 100%
rename from amqp-2.1.0/amqp_connection_resource.h
rename to amqp-2.1.1/amqp_connection_resource.h
diff --git a/amqp-2.1.0/amqp_decimal.c b/amqp-2.1.1/amqp_decimal.c
similarity index 100%
rename from amqp-2.1.0/amqp_decimal.c
rename to amqp-2.1.1/amqp_decimal.c
diff --git a/amqp-2.1.0/amqp_decimal.h b/amqp-2.1.1/amqp_decimal.h
similarity index 100%
rename from amqp-2.1.0/amqp_decimal.h
rename to amqp-2.1.1/amqp_decimal.h
diff --git a/amqp-2.1.0/amqp_envelope.c b/amqp-2.1.1/amqp_envelope.c
similarity index 98%
rename from amqp-2.1.0/amqp_envelope.c
rename to amqp-2.1.1/amqp_envelope.c
index f1ca4c2..827887c 100644
--- a/amqp-2.1.0/amqp_envelope.c
+++ b/amqp-2.1.1/amqp_envelope.c
@@ -1,308 +1,313 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
#if PHP_VERSION_ID >= 80000
#include <stdint.h>
#else
#include "win32/php_stdint.h"
#endif
#include "win32/signal.h"
#else
#include <signal.h>
#include <stdint.h>
#endif
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#include <rabbitmq-c/framing.h>
#else
#include <amqp.h>
#include <amqp_framing.h>
#endif
#ifdef PHP_WIN32
#include "win32/unistd.h"
#else
#include <unistd.h>
#endif
#include "amqp_envelope.h"
#include "amqp_basic_properties.h"
#include "php_amqp.h"
zend_class_entry *amqp_envelope_class_entry;
#define this_ce amqp_envelope_class_entry
void convert_amqp_envelope_to_zval(amqp_envelope_t *amqp_envelope, zval *envelope)
{
/* Build the envelope */
object_init_ex(envelope, this_ce);
amqp_basic_properties_t *p = &amqp_envelope->message.properties;
amqp_message_t *message = &amqp_envelope->message;
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(envelope),
ZEND_STRL("body"),
(const char *) message->body.bytes,
(size_t) message->body.len
);
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(envelope),
ZEND_STRL("consumerTag"),
(const char *) amqp_envelope->consumer_tag.bytes,
(size_t) amqp_envelope->consumer_tag.len
);
zend_update_property_long(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(envelope),
ZEND_STRL("deliveryTag"),
(zend_long) amqp_envelope->delivery_tag
);
zend_update_property_bool(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(envelope),
ZEND_STRL("isRedelivery"),
(zend_long) amqp_envelope->redelivered
);
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(envelope),
ZEND_STRL("exchangeName"),
(const char *) amqp_envelope->exchange.bytes,
(size_t) amqp_envelope->exchange.len
);
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(envelope),
ZEND_STRL("routingKey"),
(const char *) amqp_envelope->routing_key.bytes,
(size_t) amqp_envelope->routing_key.len
);
php_amqp_basic_properties_extract(p, envelope);
}
/* {{{ proto AMQPEnvelope::__construct() */
static PHP_METHOD(amqp_envelope_class, __construct)
{
PHP_AMQP_NOPARAMS()
/* BC */
php_amqp_basic_properties_set_empty_headers(getThis());
}
/* }}} */
/* {{{ proto AMQPEnvelope::getBody()*/
static PHP_METHOD(amqp_envelope_class, getBody)
{
zval rv;
PHP_AMQP_NOPARAMS()
zval *zv = PHP_AMQP_READ_THIS_PROP("body");
if (Z_STRLEN_P(zv) == 0) {
RETURN_STRING("");
}
RETURN_ZVAL(zv, 1, 0);
}
/* }}} */
/* {{{ proto AMQPEnvelope::getRoutingKey() */
static PHP_METHOD(amqp_envelope_class, getRoutingKey)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("routingKey");
}
/* }}} */
/* {{{ proto AMQPEnvelope::getDeliveryTag() */
static PHP_METHOD(amqp_envelope_class, getDeliveryTag)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("deliveryTag");
}
/* }}} */
/* {{{ proto AMQPEnvelope::getConsumerTag() */
static PHP_METHOD(amqp_envelope_class, getConsumerTag)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("consumerTag");
}
/* }}} */
/* {{{ proto AMQPEnvelope::getExchangeName() */
static PHP_METHOD(amqp_envelope_class, getExchangeName)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("exchangeName");
}
/* }}} */
/* {{{ proto AMQPEnvelope::isRedelivery() */
static PHP_METHOD(amqp_envelope_class, isRedelivery)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("isRedelivery");
}
/* }}} */
/* {{{ proto AMQPEnvelope::getHeader(string name) */
static PHP_METHOD(amqp_envelope_class, getHeader)
{
zval rv;
char *key;
size_t key_len;
zval *tmp = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
RETURN_THROWS();
}
zval *zv = PHP_AMQP_READ_THIS_PROP_CE("headers", amqp_basic_properties_class_entry);
/* Look for the hash key */
if ((tmp = zend_hash_str_find(HASH_OF(zv), key, key_len)) == NULL) {
RETURN_NULL();
}
RETURN_ZVAL(tmp, 1, 0);
}
/* }}} */
/* {{{ proto AMQPEnvelope::hasHeader(string name) */
static PHP_METHOD(amqp_envelope_class, hasHeader)
{
zval rv;
char *key;
size_t key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
RETURN_THROWS();
}
zval *zv = PHP_AMQP_READ_THIS_PROP_CE("headers", amqp_basic_properties_class_entry);
/* Look for the hash key */
RETURN_BOOL(zend_hash_str_find(HASH_OF(zv), key, key_len) != NULL);
}
/* }}} */
/* amqp_envelope_class ARG_INFO definition */
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class__construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getBody, ZEND_SEND_BY_VAL, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getRoutingKey, ZEND_SEND_BY_VAL, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getConsumerTag, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getDeliveryTag, ZEND_SEND_BY_VAL, 0, IS_LONG, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getExchangeName, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_isRedelivery, ZEND_SEND_BY_VAL, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getHeader, ZEND_SEND_BY_VAL, 1, IS_STRING, 1)
+#ifdef IS_MIXED
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_getHeader, ZEND_SEND_BY_VAL, 1, IS_MIXED, 1)
+#else
+/* PHP < 8.0 */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_getHeader, 0, 0, 1)
+#endif
ZEND_ARG_TYPE_INFO(0, headerName, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_envelope_class_hasHeader, ZEND_SEND_BY_VAL, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, headerName, IS_STRING, 0)
ZEND_END_ARG_INFO()
zend_function_entry amqp_envelope_class_functions[] = {
PHP_ME(amqp_envelope_class, __construct, arginfo_amqp_envelope_class__construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
PHP_ME(amqp_envelope_class, getBody, arginfo_amqp_envelope_class_getBody, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, getRoutingKey, arginfo_amqp_envelope_class_getRoutingKey, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, getConsumerTag, arginfo_amqp_envelope_class_getConsumerTag, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, getDeliveryTag, arginfo_amqp_envelope_class_getDeliveryTag, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, getExchangeName, arginfo_amqp_envelope_class_getExchangeName, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, isRedelivery, arginfo_amqp_envelope_class_isRedelivery, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, getHeader, arginfo_amqp_envelope_class_getHeader, ZEND_ACC_PUBLIC)
PHP_ME(amqp_envelope_class, hasHeader, arginfo_amqp_envelope_class_hasHeader, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
PHP_MINIT_FUNCTION(amqp_envelope)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "AMQPEnvelope", amqp_envelope_class_functions);
this_ce = zend_register_internal_class_ex(&ce, amqp_basic_properties_class_entry);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "body", ZEND_ACC_PRIVATE, IS_STRING, 0, ZVAL_EMPTY_STRING);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "consumerTag", ZEND_ACC_PRIVATE, IS_STRING, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "deliveryTag", ZEND_ACC_PRIVATE, IS_LONG, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "isRedelivery", ZEND_ACC_PRIVATE, _IS_BOOL, 0, ZVAL_FALSE);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "exchangeName", ZEND_ACC_PRIVATE, IS_STRING, 1, ZVAL_NULL);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(
this_ce,
"routingKey",
ZEND_ACC_PRIVATE,
IS_STRING,
0,
ZVAL_EMPTY_STRING
);
return SUCCESS;
}
diff --git a/amqp-2.1.0/amqp_envelope.h b/amqp-2.1.1/amqp_envelope.h
similarity index 100%
rename from amqp-2.1.0/amqp_envelope.h
rename to amqp-2.1.1/amqp_envelope.h
diff --git a/amqp-2.1.0/amqp_envelope_exception.c b/amqp-2.1.1/amqp_envelope_exception.c
similarity index 100%
rename from amqp-2.1.0/amqp_envelope_exception.c
rename to amqp-2.1.1/amqp_envelope_exception.c
diff --git a/amqp-2.1.0/amqp_envelope_exception.h b/amqp-2.1.1/amqp_envelope_exception.h
similarity index 100%
rename from amqp-2.1.0/amqp_envelope_exception.h
rename to amqp-2.1.1/amqp_envelope_exception.h
diff --git a/amqp-2.1.0/amqp_exchange.c b/amqp-2.1.1/amqp_exchange.c
similarity index 100%
rename from amqp-2.1.0/amqp_exchange.c
rename to amqp-2.1.1/amqp_exchange.c
diff --git a/amqp-2.1.0/amqp_exchange.h b/amqp-2.1.1/amqp_exchange.h
similarity index 100%
rename from amqp-2.1.0/amqp_exchange.h
rename to amqp-2.1.1/amqp_exchange.h
diff --git a/amqp-2.1.0/amqp_methods_handling.c b/amqp-2.1.1/amqp_methods_handling.c
similarity index 100%
rename from amqp-2.1.0/amqp_methods_handling.c
rename to amqp-2.1.1/amqp_methods_handling.c
diff --git a/amqp-2.1.0/amqp_methods_handling.h b/amqp-2.1.1/amqp_methods_handling.h
similarity index 100%
rename from amqp-2.1.0/amqp_methods_handling.h
rename to amqp-2.1.1/amqp_methods_handling.h
diff --git a/amqp-2.1.0/amqp_queue.c b/amqp-2.1.1/amqp_queue.c
similarity index 99%
rename from amqp-2.1.0/amqp_queue.c
rename to amqp-2.1.1/amqp_queue.c
index 09c684a..67229a0 100644
--- a/amqp-2.1.0/amqp_queue.c
+++ b/amqp-2.1.1/amqp_queue.c
@@ -1,1442 +1,1440 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
#if PHP_VERSION_ID >= 80000
#include <stdint.h>
#else
#include "win32/php_stdint.h"
#endif
#include "win32/signal.h"
#else
#include <signal.h>
#include <stdint.h>
#endif
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#include <rabbitmq-c/framing.h>
#else
#include <amqp.h>
#include <amqp_framing.h>
#endif
#ifdef PHP_WIN32
#include "win32/unistd.h"
#else
#include <unistd.h>
#endif
#include "php_amqp.h"
#include "amqp_envelope.h"
#include "amqp_envelope_exception.h"
#include "amqp_connection.h"
#include "amqp_channel.h"
#include "amqp_connection.h"
#include "amqp_envelope.h"
#include "amqp_queue.h"
#include "amqp_type.h"
#include "amqp_value.h"
#include "amqp_decimal.h"
#include "amqp_timestamp.h"
zend_class_entry *amqp_queue_class_entry;
#define this_ce amqp_queue_class_entry
/* {{{ proto AMQPQueue::__construct(AMQPChannel channel)
AMQPQueue constructor
*/
static PHP_METHOD(amqp_queue_class, __construct)
{
zval rv;
zval arguments;
zval *channelObj;
amqp_channel_resource *channel_resource;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &channelObj, amqp_channel_class_entry) == FAILURE) {
RETURN_THROWS();
}
ZVAL_UNDEF(&arguments);
array_init(&arguments);
zend_update_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("arguments"), &arguments);
zval_ptr_dtor(&arguments);
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(channelObj);
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not create queue.");
zend_update_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("channel"), channelObj);
zend_update_property(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("connection"),
PHP_AMQP_READ_OBJ_PROP(amqp_channel_class_entry, channelObj, "connection")
);
}
/* }}} */
/* {{{ proto AMQPQueue::getName()
Get the queue name */
static PHP_METHOD(amqp_queue_class, getName)
{
zval rv;
PHP_AMQP_NOPARAMS()
if (PHP_AMQP_READ_THIS_PROP_STRLEN("name") > 0) {
PHP_AMQP_RETURN_THIS_PROP("name");
} else {
RETURN_NULL();
}
}
/* }}} */
/* {{{ proto AMQPQueue::setName(string name)
Set the queue name */
static PHP_METHOD(amqp_queue_class, setName)
{
char *name = NULL;
size_t name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
RETURN_THROWS();
}
if (name_len < 1 || name_len > 255) {
/* Verify that the name is not null and not an empty string */
zend_throw_exception(
amqp_queue_exception_class_entry,
"Invalid queue name given, must be between 1 and 255 characters long.",
0
);
return;
}
/* Set the queue name */
zend_update_property_stringl(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("name"), name, name_len);
}
/* }}} */
/* {{{ proto AMQPQueue::getFlags()
Get the queue parameters */
static PHP_METHOD(amqp_queue_class, getFlags)
{
zval rv;
zend_long flags = 0;
PHP_AMQP_NOPARAMS()
if (PHP_AMQP_READ_THIS_PROP_BOOL("passive")) {
flags |= AMQP_PASSIVE;
}
if (PHP_AMQP_READ_THIS_PROP_BOOL("durable")) {
flags |= AMQP_DURABLE;
}
if (PHP_AMQP_READ_THIS_PROP_BOOL("exclusive")) {
flags |= AMQP_EXCLUSIVE;
}
if (PHP_AMQP_READ_THIS_PROP_BOOL("autoDelete")) {
flags |= AMQP_AUTODELETE;
}
RETURN_LONG(flags);
}
/* }}} */
/* {{{ proto AMQPQueue::setFlags(long bitmask)
Set the queue parameters */
static PHP_METHOD(amqp_queue_class, setFlags)
{
zend_long flags = AMQP_NOPARAM;
bool flags_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l!", &flags, &flags_is_null) == FAILURE) {
RETURN_THROWS();
}
flags = flags & PHP_AMQP_QUEUE_FLAGS;
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("passive"), IS_PASSIVE(flags));
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("durable"), IS_DURABLE(flags));
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("exclusive"), IS_EXCLUSIVE(flags));
zend_update_property_bool(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("autoDelete"), IS_AUTODELETE(flags));
}
/* }}} */
/* {{{ proto AMQPQueue::getArgument(string key)
Get the queue argument referenced by key */
static PHP_METHOD(amqp_queue_class, getArgument)
{
zval rv;
zval *tmp = NULL;
char *key;
size_t key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, key_len)) == NULL) {
zend_throw_exception_ex(amqp_queue_exception_class_entry, 0, "The argument \"%s\" does not exist", key);
return;
}
RETURN_ZVAL(tmp, 1, 0);
}
/* }}} */
/* {{{ proto AMQPQueue::hasArgument(string key) */
static PHP_METHOD(amqp_queue_class, hasArgument)
{
zval rv;
char *key;
size_t key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
RETURN_THROWS();
}
RETURN_BOOL(zend_hash_str_find(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, key_len) != NULL);
}
/* }}} */
/* {{{ proto AMQPQueue::getArguments
Get the queue arguments */
static PHP_METHOD(amqp_queue_class, getArguments)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("arguments");
}
/* }}} */
/* {{{ proto AMQPQueue::setArguments(array args)
Overwrite all queue arguments with given args */
static PHP_METHOD(amqp_queue_class, setArguments)
{
zval *zvalArguments;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &zvalArguments) == FAILURE) {
RETURN_THROWS();
}
zend_update_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("arguments"), zvalArguments);
}
/* }}} */
/* {{{ proto AMQPQueue::setArgument(key, value)
Get the queue name */
static PHP_METHOD(amqp_queue_class, setArgument)
{
zval rv;
char *key = NULL;
size_t key_len = 0;
zval *value = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &key, &key_len, &value) == FAILURE) {
RETURN_THROWS();
}
switch (Z_TYPE_P(value)) {
case IS_OBJECT:
if (!instanceof_function(Z_OBJCE_P(value), amqp_timestamp_class_entry) &&
!instanceof_function(Z_OBJCE_P(value), amqp_decimal_class_entry) &&
!instanceof_function(Z_OBJCE_P(value), amqp_value_class_entry)) {
goto err;
}
// Intentional fall-through
case IS_NULL:
case IS_TRUE:
case IS_FALSE:
case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_ARRAY:
zend_hash_str_add(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, key_len, value);
Z_TRY_ADDREF_P(value);
break;
default:
err:
zend_throw_exception(
amqp_queue_exception_class_entry,
"The value parameter must be of type bool, int, double, string, null, array, AMQPTimestamp, "
"AMQPDecimal, or an implementation of AMQPValue.",
0
);
return;
}
}
/* }}} */
/* {{{ proto AMQPQueue::removeArgument(key)
Get the queue name */
static PHP_METHOD(amqp_queue_class, removeArgument)
{
zval rv;
char *key = NULL;
size_t key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
RETURN_THROWS();
}
- zend_hash_str_del_ind(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, key_len);
+ if (zend_hash_str_exists_ind(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, key_len)) {
+ zend_hash_str_del_ind(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, key_len);
+ }
}
/* }}} */
/* {{{ proto int AMQPQueue::declareQueue();
declare queue
*/
static PHP_METHOD(amqp_queue_class, declareQueue)
{
zval rv;
amqp_channel_resource *channel_resource;
char *name;
amqp_table_t *arguments;
zend_long message_count;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not declare queue.");
arguments = php_amqp_type_convert_zval_to_amqp_table(PHP_AMQP_READ_THIS_PROP("arguments"));
amqp_queue_declare_ok_t *r = amqp_queue_declare(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : ""),
PHP_AMQP_READ_THIS_PROP_BOOL("passive"),
PHP_AMQP_READ_THIS_PROP_BOOL("durable"),
PHP_AMQP_READ_THIS_PROP_BOOL("exclusive"),
PHP_AMQP_READ_THIS_PROP_BOOL("autoDelete"),
*arguments
);
php_amqp_type_free_amqp_table(arguments);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
message_count = r->message_count;
/* Set the queue name, in case it is an autogenerated queue name */
name = php_amqp_type_amqp_bytes_to_char(r->queue);
zend_update_property_string(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("name"), name);
efree(name);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
RETURN_LONG(message_count);
}
/* }}} */
/* {{{ proto int AMQPQueue::bind(string exchangeName, [string routingKey, array arguments]);
bind queue to exchange by routing key
*/
static PHP_METHOD(amqp_queue_class, bind)
{
zval rv;
zval *zvalArguments = NULL;
amqp_channel_resource *channel_resource;
char *exchange_name;
size_t exchange_name_len;
char *keyname = NULL;
size_t keyname_len = 0;
amqp_table_t *arguments = NULL;
if (zend_parse_parameters(
ZEND_NUM_ARGS(),
"s|s!a",
&exchange_name,
&exchange_name_len,
&keyname,
&keyname_len,
&zvalArguments
) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not bind queue.");
if (zvalArguments) {
arguments = php_amqp_type_convert_zval_to_amqp_table(zvalArguments);
}
amqp_queue_bind(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : ""),
(exchange_name_len > 0 ? amqp_cstring_bytes(exchange_name) : amqp_empty_bytes),
(keyname_len > 0 ? amqp_cstring_bytes(keyname) : amqp_empty_bytes),
(arguments ? *arguments : amqp_empty_table)
);
if (arguments) {
php_amqp_type_free_amqp_table(arguments);
}
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_queue_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
- return;
+ RETURN_THROWS();
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto int AMQPQueue::get([bit flags=AMQP_NOPARAM]);
read messages from queue
return array (messages)
*/
static PHP_METHOD(amqp_queue_class, get)
{
zval rv;
amqp_channel_resource *channel_resource;
zval message;
zend_long flags = INI_INT("amqp.auto_ack") ? AMQP_AUTOACK : AMQP_NOPARAM;
bool flags_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &flags, &flags_is_null) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not get messages from queue.");
amqp_rpc_reply_t res = amqp_basic_get(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : ""),
(AMQP_AUTOACK & flags) ? 1 : 0
);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_queue_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
if (AMQP_BASIC_GET_EMPTY_METHOD == res.reply.id) {
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
RETURN_NULL();
}
assert(AMQP_BASIC_GET_OK_METHOD == res.reply.id);
/* Fill the envelope from response */
amqp_basic_get_ok_t *get_ok_method = res.reply.decoded;
amqp_envelope_t envelope;
envelope.channel = channel_resource->channel_id;
envelope.consumer_tag = amqp_empty_bytes;
envelope.delivery_tag = get_ok_method->delivery_tag;
envelope.redelivered = get_ok_method->redelivered;
envelope.exchange = amqp_bytes_malloc_dup(get_ok_method->exchange);
envelope.routing_key = amqp_bytes_malloc_dup(get_ok_method->routing_key);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
res = amqp_read_message(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
&envelope.message,
0
);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_queue_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
amqp_destroy_envelope(&envelope);
return;
}
ZVAL_UNDEF(&message);
convert_amqp_envelope_to_zval(&envelope, &message);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
amqp_destroy_envelope(&envelope);
RETVAL_ZVAL(&message, 1, 0);
zval_ptr_dtor(&message);
}
/* }}} */
/* {{{ proto array AMQPQueue::consume([callback, flags = <bitmask>, consumer_tag]);
consume the message
*/
static PHP_METHOD(amqp_queue_class, consume)
{
zval rv;
zval current_channel_zv;
zval *current_queue_zv = NULL;
amqp_channel_resource *channel_resource;
amqp_channel_resource *current_channel_resource;
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
amqp_table_t *arguments;
char *consumer_tag = NULL;
size_t consumer_tag_len = 0;
zend_long flags = INI_INT("amqp.auto_ack") ? AMQP_AUTOACK : AMQP_NOPARAM;
bool flags_is_null = 1;
if (zend_parse_parameters(
ZEND_NUM_ARGS(),
"|f!l!s!",
&fci,
&fci_cache,
&flags,
&flags_is_null,
&consumer_tag,
&consumer_tag_len
) == FAILURE) {
RETURN_THROWS();
}
zval *channel_zv = PHP_AMQP_READ_THIS_PROP("channel");
zval *consumers =
zend_read_property(amqp_channel_class_entry, PHP_AMQP_COMPAT_OBJ_P(channel_zv), ZEND_STRL("consumers"), 0, &rv);
if (IS_ARRAY != Z_TYPE_P(consumers)) {
zend_throw_exception(
amqp_queue_exception_class_entry,
"Invalid channel consumers, forgot to call channel constructor?",
0
);
- return;
+ RETURN_THROWS();
}
amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(channel_zv);
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(channel_zv);
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not get channel.");
if (!(AMQP_JUST_CONSUME & flags)) {
/* Set up the consume loop */
arguments = php_amqp_type_convert_zval_to_amqp_table(PHP_AMQP_READ_THIS_PROP("arguments"));
amqp_basic_consume_ok_t *r = amqp_basic_consume(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : ""),
(consumer_tag_len > 0 ? amqp_cstring_bytes(consumer_tag) : amqp_empty_bytes), /* Consumer tag */
(AMQP_NOLOCAL & flags) ? 1 : 0, /* No local */
(AMQP_AUTOACK & flags) ? 1 : 0, /* no_ack, aka AUTOACK */
PHP_AMQP_READ_THIS_PROP_BOOL("exclusive"),
*arguments
);
php_amqp_type_free_amqp_table(arguments);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
zend_throw_exception(amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code));
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
- return;
+ RETURN_THROWS();
}
char *key;
key = estrndup((char *) r->consumer_tag.bytes, (unsigned) r->consumer_tag.len);
if (zend_hash_str_find(Z_ARRVAL_P(consumers), key, r->consumer_tag.len) != NULL) {
// This should never happen as AMQP server guarantees that consumer tag is unique within channel
zend_throw_exception(amqp_exception_class_entry, "Duplicate consumer tag", 0);
efree(key);
- return;
+ RETURN_THROWS();
}
zval tmp;
ZVAL_UNDEF(&tmp);
ZVAL_COPY(&tmp, getThis());
zend_hash_str_add(Z_ARRVAL_P(consumers), key, r->consumer_tag.len, &tmp);
efree(key);
/* Set the consumer tag name, in case it is an autogenerated consumer tag name */
zend_update_property_stringl(
this_ce,
PHP_AMQP_COMPAT_OBJ_P(getThis()),
ZEND_STRL("consumerTag"),
(const char *) r->consumer_tag.bytes,
(size_t) r->consumer_tag.len
);
}
if (!ZEND_FCI_INITIALIZED(fci)) {
- /* Callback not set, we have nothing to do - real consuming may happens later */
+ /* Callback not set, we have nothing to do - real consuming may happen later */
return;
}
struct timeval tv = {0};
struct timeval *tv_ptr = &tv;
double read_timeout = PHP_AMQP_READ_OBJ_PROP_DOUBLE(
amqp_connection_class_entry,
PHP_AMQP_READ_THIS_PROP("connection"),
"readTimeout"
);
if (read_timeout > 0) {
tv.tv_sec = (long int) read_timeout;
tv.tv_usec = (long int) ((read_timeout - tv.tv_sec) * 1000000);
} else {
tv_ptr = NULL;
}
while (1) {
/* Initialize the message */
zval message;
amqp_envelope_t envelope;
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
amqp_rpc_reply_t res =
amqp_consume_message(channel_resource->connection_resource->connection_state, &envelope, tv_ptr, 0);
if (AMQP_RESPONSE_NORMAL != res.reply_type) {
if (AMQP_RESPONSE_LIBRARY_EXCEPTION == res.reply_type) {
// Special case consumer timeout: do not close connection but end consumption
if (AMQP_STATUS_TIMEOUT == res.library_error) {
zend_throw_exception(amqp_queue_exception_class_entry, "Consumer timeout exceed", 0);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
// Handle a potentially recoverable error
if (AMQP_STATUS_UNEXPECTED_STATE == res.library_error &&
PHP_AMQP_RESOURCE_RESPONSE_OK <=
php_amqp_connection_resource_error_advanced(res, &PHP_AMQP_G(error_message), channel)) {
continue;
}
}
/* Mark connection resource as closed to prevent sending any further requests */
channel_resource->connection_resource->is_connected = '\0';
php_amqp_disconnect_force(channel_resource->connection_resource);
php_amqp_zend_throw_exception_short(res, amqp_queue_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
- return;
+ RETURN_THROWS();
}
ZVAL_UNDEF(&message);
convert_amqp_envelope_to_zval(&envelope, &message);
current_channel_resource = channel_resource->connection_resource->slots[envelope.channel - 1];
if (!current_channel_resource) {
// This should never happen, but just in case
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
"Orphaned channel. Please, report a bug.",
0
);
amqp_destroy_envelope(&envelope);
break;
}
ZVAL_UNDEF(&current_channel_zv);
ZVAL_OBJ(&current_channel_zv, &current_channel_resource->parent->zo);
consumers = zend_read_property(
amqp_channel_class_entry,
PHP_AMQP_COMPAT_OBJ_P(&current_channel_zv),
ZEND_STRL("consumers"),
0,
&rv
);
if (IS_ARRAY != Z_TYPE_P(consumers)) {
zend_throw_exception(
amqp_queue_exception_class_entry,
"Invalid channel consumers, forgot to call channel constructor?",
0
);
amqp_destroy_envelope(&envelope);
break;
}
char *key;
key = estrndup((char *) envelope.consumer_tag.bytes, (unsigned) envelope.consumer_tag.len);
if ((current_queue_zv = zend_hash_str_find(Z_ARRVAL_P(consumers), key, envelope.consumer_tag.len)) == NULL) {
zval exception;
ZVAL_UNDEF(&exception);
object_init_ex(&exception, amqp_envelope_exception_class_entry);
zend_update_property_string(
zend_exception_get_default(),
PHP_AMQP_COMPAT_OBJ_P(&exception),
ZEND_STRL("message"),
"Orphaned envelope"
);
zend_update_property(
amqp_envelope_exception_class_entry,
PHP_AMQP_COMPAT_OBJ_P(&exception),
ZEND_STRL("envelope"),
&message
);
zend_throw_exception_object(&exception);
zval_ptr_dtor(&message);
amqp_destroy_envelope(&envelope);
efree(key);
break;
}
efree(key);
amqp_destroy_envelope(&envelope);
/* Make the callback */
zval params;
zval retval;
/* Build the parameter array */
ZVAL_UNDEF(&params);
array_init(&params);
/* Dump it into the params array */
add_index_zval(&params, 0, &message);
Z_ADDREF_P(&message);
/* Add a pointer to the queue: */
add_index_zval(&params, 1, current_queue_zv);
Z_ADDREF_P(current_queue_zv);
/* Convert everything to be callable */
zend_fcall_info_args(&fci, &params);
/* Initialize the return value pointer */
fci.retval = &retval;
- /* Call the function, and track the return value */
- if (zend_call_function(&fci, &fci_cache) == SUCCESS && fci.retval) {
- RETVAL_ZVAL(&retval, 1, 1);
- }
+ zend_call_function(&fci, &fci_cache);
/* Clean up our mess */
zend_fcall_info_args_clear(&fci, 1);
zval_ptr_dtor(&params);
zval_ptr_dtor(&message);
/* Check if user land function wants to bail */
- if (EG(exception) || Z_TYPE_P(return_value) == IS_FALSE) {
+ if (EG(exception) || Z_TYPE_P(&retval) == IS_FALSE) {
break;
}
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
- return;
}
/* }}} */
/* {{{ proto int AMQPQueue::ack(long deliveryTag, [bit flags=AMQP_NOPARAM]);
acknowledge the message
*/
static PHP_METHOD(amqp_queue_class, ack)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long deliveryTag = 0;
zend_long flags = AMQP_NOPARAM;
bool flags_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l!", &deliveryTag, &flags, &flags_is_null) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not ack message.");
/* NOTE: basic.ack is asynchronous and thus will not indicate failure if something goes wrong on the broker */
int status = amqp_basic_ack(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(uint64_t) deliveryTag,
(AMQP_MULTIPLE & flags) ? 1 : 0
);
if (status != AMQP_STATUS_OK) {
/* Emulate library error */
amqp_rpc_reply_t res;
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
}
/* }}} */
/* {{{ proto int AMQPQueue::nack(long deliveryTag, [bit flags=AMQP_NOPARAM]);
acknowledge the message
*/
static PHP_METHOD(amqp_queue_class, nack)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long deliveryTag = 0;
zend_long flags = AMQP_NOPARAM;
bool flags_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l!", &deliveryTag, &flags, &flags_is_null) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not nack message.");
/* NOTE: basic.nack is asynchronous and thus will not indicate failure if something goes wrong on the broker */
int status = amqp_basic_nack(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(uint64_t) deliveryTag,
(AMQP_MULTIPLE & flags) ? 1 : 0,
(AMQP_REQUEUE & flags) ? 1 : 0
);
if (status != AMQP_STATUS_OK) {
/* Emulate library error */
amqp_rpc_reply_t res;
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
}
/* }}} */
/* {{{ proto int AMQPQueue::reject(long deliveryTag, [bit flags=AMQP_NOPARAM]);
acknowledge the message
*/
static PHP_METHOD(amqp_queue_class, reject)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long deliveryTag = 0;
zend_long flags = AMQP_NOPARAM;
bool flags_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l!", &deliveryTag, &flags, &flags_is_null) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not reject message.");
/* NOTE: basic.reject is asynchronous and thus will not indicate failure if something goes wrong on the broker */
int status = amqp_basic_reject(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
(uint64_t) deliveryTag,
(AMQP_REQUEUE & flags) ? 1 : 0
);
if (status != AMQP_STATUS_OK) {
/* Emulate library error */
amqp_rpc_reply_t res;
res.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
res.library_error = status;
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
}
/* }}} */
/* {{{ proto int AMQPQueue::purge();
purge queue
*/
static PHP_METHOD(amqp_queue_class, purge)
{
zval rv;
amqp_channel_resource *channel_resource;
PHP_AMQP_NOPARAMS()
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not purge queue.");
amqp_queue_purge_ok_t *r = amqp_queue_purge(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : "")
);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
RETURN_LONG(r->message_count);
}
/* }}} */
/* {{{ proto int AMQPQueue::cancel([string consumerTag]);
cancel queue to consumer
*/
static PHP_METHOD(amqp_queue_class, cancel)
{
zval rv;
amqp_channel_resource *channel_resource;
char *consumer_tag = NULL;
size_t consumer_tag_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &consumer_tag, &consumer_tag_len) == FAILURE) {
RETURN_THROWS();
}
zval *channel_zv = PHP_AMQP_READ_THIS_PROP("channel");
zval *consumers =
zend_read_property(amqp_channel_class_entry, PHP_AMQP_COMPAT_OBJ_P(channel_zv), ZEND_STRL("consumers"), 0, &rv);
bool previous_consumer_tag_exists = (bool) (IS_STRING == Z_TYPE_P(PHP_AMQP_READ_THIS_PROP("consumerTag")));
if (IS_ARRAY != Z_TYPE_P(consumers)) {
zend_throw_exception(
amqp_queue_exception_class_entry,
"Invalid channel consumers, forgot to call channel constructor?",
0
);
- return;
+ RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(channel_zv);
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not cancel queue.");
if (!consumer_tag_len && (!previous_consumer_tag_exists || !PHP_AMQP_READ_THIS_PROP_STRLEN("consumerTag"))) {
return;
}
amqp_basic_cancel_ok_t *r = amqp_basic_cancel(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
consumer_tag_len > 0 ? amqp_cstring_bytes(consumer_tag)
: amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STR("consumerTag"))
);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
if (!consumer_tag_len ||
(previous_consumer_tag_exists && strcmp(consumer_tag, PHP_AMQP_READ_THIS_PROP_STR("consumerTag")) == 0)) {
zend_update_property_null(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL("consumerTag"));
}
zend_hash_str_del_ind(Z_ARRVAL_P(consumers), r->consumer_tag.bytes, r->consumer_tag.len);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto int AMQPQueue::recover([boolean requeue]);
recover messages already delivered to the consumer
*/
static PHP_METHOD(amqp_queue_class, recover)
{
zval rv;
amqp_channel_resource *channel_resource;
bool requeue = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &requeue) == FAILURE) {
RETURN_THROWS();
}
zval *channel_zv = PHP_AMQP_READ_THIS_PROP("channel");
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(channel_zv);
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not recover messages.");
amqp_basic_recover_ok_t *r = amqp_basic_recover(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
requeue
);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto int AMQPQueue::unbind(string exchangeName, [string routingKey, array arguments]);
unbind queue from exchange
*/
static PHP_METHOD(amqp_queue_class, unbind)
{
zval rv;
zval *zvalArguments = NULL;
amqp_channel_resource *channel_resource;
char *exchange_name;
size_t exchange_name_len;
char *keyname = NULL;
size_t keyname_len = 0;
amqp_table_t *arguments = NULL;
if (zend_parse_parameters(
ZEND_NUM_ARGS(),
"s|s!a",
&exchange_name,
&exchange_name_len,
&keyname,
&keyname_len,
&zvalArguments
) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not unbind queue.");
if (zvalArguments) {
arguments = php_amqp_type_convert_zval_to_amqp_table(zvalArguments);
}
amqp_queue_unbind(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : ""),
(exchange_name_len > 0 ? amqp_cstring_bytes(exchange_name) : amqp_empty_bytes),
(keyname_len > 0 ? amqp_cstring_bytes(keyname) : amqp_empty_bytes),
(arguments ? *arguments : amqp_empty_table)
);
if (arguments) {
php_amqp_type_free_amqp_table(arguments);
}
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
if (PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_queue_exception_class_entry);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto int AMQPQueue::delete([long flags = AMQP_NOPARAM]]);
delete queue and return the number of messages deleted in it
*/
static PHP_METHOD(amqp_queue_class, delete)
{
zval rv;
amqp_channel_resource *channel_resource;
zend_long flags = AMQP_NOPARAM;
bool flags_is_null = 1;
zend_long message_count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &flags, &flags_is_null) == FAILURE) {
RETURN_THROWS();
}
channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not delete queue.");
amqp_queue_delete_ok_t *r = amqp_queue_delete(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(PHP_AMQP_READ_THIS_PROP_STRLEN("name") ? PHP_AMQP_READ_THIS_PROP_STR("name") : ""),
(AMQP_IFUNUSED & flags) ? 1 : 0,
(AMQP_IFEMPTY & flags) ? 1 : 0
);
if (!r) {
amqp_rpc_reply_t res = amqp_get_rpc_reply(channel_resource->connection_resource->connection_state);
php_amqp_error(res, &PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource);
php_amqp_zend_throw_exception(
res,
amqp_queue_exception_class_entry,
PHP_AMQP_G(error_message),
PHP_AMQP_G(error_code)
);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
message_count = r->message_count;
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
RETURN_LONG(message_count);
}
/* }}} */
/* {{{ proto AMQPChannel::getChannel()
Get the AMQPChannel object in use */
static PHP_METHOD(amqp_queue_class, getChannel)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("channel");
}
/* }}} */
/* {{{ proto AMQPChannel::getConnection()
Get the AMQPConnection object in use */
static PHP_METHOD(amqp_queue_class, getConnection)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("connection");
}
/* }}} */
/* {{{ proto string AMQPChannel::getConsumerTag()
Get latest consumer tag*/
static PHP_METHOD(amqp_queue_class, getConsumerTag)
{
zval rv;
PHP_AMQP_NOPARAMS()
PHP_AMQP_RETURN_THIS_PROP("consumerTag");
}
/* }}} */
/* amqp_queue_class ARG_INFO definition */
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class__construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_OBJ_INFO(0, channel, AMQPChannel, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_getName, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_setName, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_getFlags, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_setFlags, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getArgument, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_TYPE_INFO(0, argumentName, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_getArguments, ZEND_SEND_BY_VAL, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_setArgument, ZEND_SEND_BY_VAL, 2, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, argumentName, IS_STRING, 0)
ZEND_ARG_INFO(0, argumentValue)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_removeArgument, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, argumentName, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_hasArgument, ZEND_SEND_BY_VAL, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, argumentName, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_setArguments, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_ARRAY_INFO(0, arguments, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_declareQueue, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_bind, ZEND_RETURN_VALUE, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, exchangeName, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, routingKey, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arguments, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_amqp_queue_class_get, ZEND_SEND_BY_VAL, 0, AMQPEnvelope, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_consume, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, consumerTag, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_ack, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, deliveryTag, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_nack, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, deliveryTag, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_reject, ZEND_SEND_BY_VAL, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, deliveryTag, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_recover, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, requeue, _IS_BOOL, 0, "true")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_purge, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_cancel, ZEND_SEND_BY_VAL, 0, IS_VOID, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, consumerTag, IS_STRING, 0, "\"\"")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_unbind, ZEND_RETURN_VALUE, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, exchangeName, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, routingKey, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arguments, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_delete, ZEND_SEND_BY_VAL, 0, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO(arginfo_amqp_queue_class_getChannel, AMQPChannel, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO(arginfo_amqp_queue_class_getConnection, AMQPConnection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_amqp_queue_class_getConsumerTag, ZEND_SEND_BY_VAL, 0, IS_STRING, 1)
ZEND_END_ARG_INFO()
zend_function_entry amqp_queue_class_functions[] = {
PHP_ME(amqp_queue_class, __construct, arginfo_amqp_queue_class__construct, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getName, arginfo_amqp_queue_class_getName, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, setName, arginfo_amqp_queue_class_setName, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getFlags, arginfo_amqp_queue_class_getFlags, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, setFlags, arginfo_amqp_queue_class_setFlags, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getArgument, arginfo_amqp_queue_class_getArgument, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getArguments, arginfo_amqp_queue_class_getArguments, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, setArgument, arginfo_amqp_queue_class_setArgument, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, removeArgument, arginfo_amqp_queue_class_removeArgument, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, setArguments, arginfo_amqp_queue_class_setArguments, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, hasArgument, arginfo_amqp_queue_class_hasArgument, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, declareQueue, arginfo_amqp_queue_class_declareQueue, ZEND_ACC_PUBLIC)
PHP_MALIAS(amqp_queue_class, declare, declareQueue, arginfo_amqp_queue_class_declareQueue, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, bind, arginfo_amqp_queue_class_bind, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, get, arginfo_amqp_queue_class_get, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, consume, arginfo_amqp_queue_class_consume, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, ack, arginfo_amqp_queue_class_ack, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, nack, arginfo_amqp_queue_class_nack, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, reject, arginfo_amqp_queue_class_reject, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, recover, arginfo_amqp_queue_class_recover, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, purge, arginfo_amqp_queue_class_purge, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, cancel, arginfo_amqp_queue_class_cancel, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, delete, arginfo_amqp_queue_class_delete, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, unbind, arginfo_amqp_queue_class_unbind, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getChannel, arginfo_amqp_queue_class_getChannel, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getConnection, arginfo_amqp_queue_class_getConnection, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, getConsumerTag, arginfo_amqp_queue_class_getConsumerTag, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
PHP_MINIT_FUNCTION(amqp_queue)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "AMQPQueue", amqp_queue_class_functions);
this_ce = zend_register_internal_class(&ce);
PHP_AMQP_DECLARE_TYPED_PROPERTY_OBJ(this_ce, "connection", ZEND_ACC_PRIVATE, AMQPConnection, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY_OBJ(this_ce, "channel", ZEND_ACC_PRIVATE, AMQPChannel, 0);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "name", ZEND_ACC_PRIVATE, IS_STRING, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY(this_ce, "consumerTag", ZEND_ACC_PRIVATE, IS_STRING, 1);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "passive", ZEND_ACC_PRIVATE, _IS_BOOL, 0, ZVAL_FALSE);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "durable", ZEND_ACC_PRIVATE, _IS_BOOL, 0, ZVAL_FALSE);
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "exclusive", ZEND_ACC_PRIVATE, _IS_BOOL, 0, ZVAL_FALSE);
/* By default, the auto_delete flag should be set */
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "autoDelete", ZEND_ACC_PRIVATE, _IS_BOOL, 0, ZVAL_TRUE);
#if PHP_VERSION_ID >= 80000
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "arguments", ZEND_ACC_PRIVATE, IS_ARRAY, 0, ZVAL_EMPTY_ARRAY);
#else
PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(this_ce, "arguments", ZEND_ACC_PRIVATE, IS_ARRAY, 0, ZVAL_NULL);
#endif
return SUCCESS;
}
diff --git a/amqp-2.1.0/amqp_queue.h b/amqp-2.1.1/amqp_queue.h
similarity index 100%
rename from amqp-2.1.0/amqp_queue.h
rename to amqp-2.1.1/amqp_queue.h
diff --git a/amqp-2.1.0/amqp_timestamp.c b/amqp-2.1.1/amqp_timestamp.c
similarity index 100%
rename from amqp-2.1.0/amqp_timestamp.c
rename to amqp-2.1.1/amqp_timestamp.c
diff --git a/amqp-2.1.0/amqp_timestamp.h b/amqp-2.1.1/amqp_timestamp.h
similarity index 100%
rename from amqp-2.1.0/amqp_timestamp.h
rename to amqp-2.1.1/amqp_timestamp.h
diff --git a/amqp-2.1.0/amqp_type.c b/amqp-2.1.1/amqp_type.c
similarity index 99%
rename from amqp-2.1.0/amqp_type.c
rename to amqp-2.1.1/amqp_type.c
index c43cb42..71abfb3 100644
--- a/amqp-2.1.0/amqp_type.c
+++ b/amqp-2.1.1/amqp_type.c
@@ -1,415 +1,416 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#else
#include <amqp.h>
#endif
#include "Zend/zend_interfaces.h"
#include "Zend/zend_exceptions.h"
#include "amqp_value.h"
#include "amqp_decimal.h"
#include "amqp_timestamp.h"
#include "amqp_type.h"
#ifdef PHP_WIN32
#define strtoimax _strtoi64
#endif
static void php_amqp_type_free_amqp_array_internal(amqp_array_t *array);
static void php_amqp_type_free_amqp_table_internal(amqp_table_t *object, bool clear_root);
void php_amqp_type_zval_to_amqp_array_internal(zval *value, amqp_array_t *arguments, zend_ulong depth);
void php_amqp_type_zval_to_amqp_container_internal(zval *array, amqp_field_value_t **field_ptr, zend_ulong depth);
void php_amqp_type_zval_to_amqp_table_internal(zval *array, amqp_table_t *amqp_table, zend_ulong depth);
bool php_amqp_type_zval_to_amqp_value_internal(
zval *value,
amqp_field_value_t **field_ptr,
char *key,
zend_ulong depth
);
amqp_bytes_t php_amqp_type_char_to_amqp_long(char const *cstr, size_t len)
{
amqp_bytes_t result;
if (len < 1) {
return amqp_empty_bytes;
}
result.len = (size_t) len;
result.bytes = (void *) cstr;
return result;
}
char *php_amqp_type_amqp_bytes_to_char(amqp_bytes_t bytes)
{
/* We will need up to 4 chars per byte, plus the terminating 0 */
char *res = emalloc(bytes.len * 4 + 1);
uint8_t *data = bytes.bytes;
char *p = res;
size_t i;
for (i = 0; i < bytes.len; i++) {
if (data[i] >= 32 && data[i] != 127) {
*p++ = data[i];
} else {
*p++ = '\\';
*p++ = '0' + (data[i] >> 6);
*p++ = '0' + (data[i] >> 3 & 0x7);
*p++ = '0' + (data[i] & 0x7);
}
}
*p = 0;
return res;
}
void php_amqp_type_zval_to_amqp_container_internal(zval *array, amqp_field_value_t **field_ptr, zend_ulong depth)
{
HashTable *ht;
zend_string *key;
amqp_field_value_t *field;
ht = Z_ARRVAL_P(array);
bool is_amqp_array = 1;
ZEND_HASH_FOREACH_STR_KEY(ht, key)
if (key) {
is_amqp_array = 0;
break;
}
ZEND_HASH_FOREACH_END ();
field = *field_ptr;
if (is_amqp_array) {
field->kind = AMQP_FIELD_KIND_ARRAY;
php_amqp_type_zval_to_amqp_array_internal(array, &field->value.array, depth);
} else {
field->kind = AMQP_FIELD_KIND_TABLE;
php_amqp_type_zval_to_amqp_table_internal(array, &field->value.table, depth);
}
}
void php_amqp_type_zval_to_amqp_table_internal(zval *array, amqp_table_t *amqp_table, zend_ulong depth)
{
HashTable *ht;
zval *value_nested;
zend_string *zkey;
zend_ulong index;
char *key;
unsigned key_len;
ht = Z_ARRVAL_P(array);
amqp_table->entries =
(amqp_table_entry_t *) ecalloc((size_t) zend_hash_num_elements(ht), sizeof(amqp_table_entry_t));
amqp_table->num_entries = 0;
ZEND_HASH_FOREACH_KEY_VAL(ht, index, zkey, value_nested)
char *string_key;
amqp_table_entry_t *table_entry;
amqp_field_value_t *field;
/* Now pull the key */
if (!zkey) {
if (depth > 0) {
/* Convert to strings non-string keys */
char str[32];
key_len = snprintf(str, 32, "%lu", index);
key = str;
} else {
/* Skip things that are not strings */
php_error_docref(NULL, E_WARNING, "Ignoring non-string header field '%lu'", index);
continue;
}
} else {
key_len = ZSTR_LEN(zkey);
key = ZSTR_VAL(zkey);
}
string_key = estrndup(key, key_len);
/* Build the array */
table_entry = &amqp_table->entries[amqp_table->num_entries++];
field = &table_entry->value;
if (!php_amqp_type_zval_to_amqp_value_internal(value_nested, &field, key, depth + 1)) {
/* Reset entries counter back */
amqp_table->num_entries--;
+ efree(string_key);
continue;
}
table_entry->key = amqp_cstring_bytes(string_key);
ZEND_HASH_FOREACH_END();
}
void php_amqp_type_zval_to_amqp_array_internal(zval *value, amqp_array_t *arguments, zend_ulong depth)
{
HashTable *ht;
zval *value_nested;
zend_string *zkey;
ht = Z_ARRVAL_P(value);
/* Allocate all the memory necessary for storing the arguments */
arguments->entries =
(amqp_field_value_t *) ecalloc((size_t) zend_hash_num_elements(ht), sizeof(amqp_field_value_t));
arguments->num_entries = 0;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, zkey, value_nested)
amqp_field_value_t *field = &arguments->entries[arguments->num_entries++];
if (!php_amqp_type_zval_to_amqp_value_internal(value_nested, &field, ZSTR_VAL(zkey), depth)) {
/* Reset entries counter back */
arguments->num_entries--;
continue;
}
ZEND_HASH_FOREACH_END ();
}
bool php_amqp_type_zval_to_amqp_value_internal(zval *value, amqp_field_value_t **field_ptr, char *key, zend_ulong depth)
{
bool result;
char type[16];
amqp_field_value_t *field;
if (depth > PHP_AMQP_G(serialization_depth)) {
zend_throw_exception_ex(
amqp_exception_class_entry,
0,
"Maximum serialization depth of %ld reached while serializing value",
PHP_AMQP_G(serialization_depth)
);
return 0;
}
result = 1;
field = *field_ptr;
switch (Z_TYPE_P(value)) {
case IS_TRUE:
case IS_FALSE:
field->kind = AMQP_FIELD_KIND_BOOLEAN;
field->value.boolean = (amqp_boolean_t) Z_TYPE_P(value) != IS_FALSE;
break;
case IS_DOUBLE:
field->kind = AMQP_FIELD_KIND_F64;
field->value.f64 = Z_DVAL_P(value);
break;
case IS_LONG:
field->kind = AMQP_FIELD_KIND_I64;
field->value.i64 = Z_LVAL_P(value);
break;
case IS_STRING:
field->kind = AMQP_FIELD_KIND_UTF8;
if (Z_STRLEN_P(value)) {
amqp_bytes_t bytes;
bytes.len = (size_t) Z_STRLEN_P(value);
bytes.bytes = estrndup(Z_STRVAL_P(value), (unsigned) Z_STRLEN_P(value));
field->value.bytes = bytes;
} else {
field->value.bytes = amqp_empty_bytes;
}
break;
case IS_ARRAY:
php_amqp_type_zval_to_amqp_container_internal(value, &field, depth + 1);
break;
case IS_NULL:
field->kind = AMQP_FIELD_KIND_VOID;
break;
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(value), amqp_timestamp_class_entry)) {
zval result_zv;
zend_call_method_with_0_params(
PHP_AMQP_COMPAT_OBJ_P(value),
amqp_timestamp_class_entry,
NULL,
"gettimestamp",
&result_zv
);
field->kind = AMQP_FIELD_KIND_TIMESTAMP;
field->value.u64 = Z_DVAL(result_zv);
zval_ptr_dtor(&result_zv);
break;
} else if (instanceof_function(Z_OBJCE_P(value), amqp_decimal_class_entry)) {
field->kind = AMQP_FIELD_KIND_DECIMAL;
zval result_zv;
zend_call_method_with_0_params(
PHP_AMQP_COMPAT_OBJ_P(value),
amqp_decimal_class_entry,
NULL,
"getexponent",
&result_zv
);
field->value.decimal.decimals = (uint8_t) Z_LVAL(result_zv);
zval_ptr_dtor(&result_zv);
zend_call_method_with_0_params(
PHP_AMQP_COMPAT_OBJ_P(value),
amqp_decimal_class_entry,
NULL,
"getsignificand",
&result_zv
);
field->value.decimal.value = (uint32_t) Z_LVAL(result_zv);
zval_ptr_dtor(&result_zv);
break;
} else if (instanceof_function(Z_OBJCE_P(value), amqp_value_class_entry)) {
zval result_zv;
zend_call_method_with_0_params(
PHP_AMQP_COMPAT_OBJ_P(value),
Z_OBJCE_P(value),
NULL,
"toamqpvalue",
&result_zv
);
bool recursion_res = php_amqp_type_zval_to_amqp_value_internal(&result_zv, field_ptr, key, depth + 1);
zval_ptr_dtor(&result_zv);
return recursion_res;
}
default:
switch (Z_TYPE_P(value)) {
case IS_OBJECT:
strcpy(type, "object");
break;
case IS_RESOURCE:
strcpy(type, "resource");
break;
default:
strcpy(type, "unknown");
break;
}
php_error_docref(NULL, E_WARNING, "Ignoring field '%s' due to unsupported value type (%s)", key, type);
result = 0;
break;
}
return result;
}
amqp_table_t *php_amqp_type_convert_zval_to_amqp_table(zval *php_array)
{
amqp_table_t *amqp_table;
/* In setArguments, we are overwriting all the existing values */
amqp_table = (amqp_table_t *) emalloc(sizeof(amqp_table_t));
php_amqp_type_zval_to_amqp_table_internal(php_array, amqp_table, 0);
return amqp_table;
}
static void php_amqp_type_free_amqp_array_internal(amqp_array_t *array)
{
if (!array) {
return;
}
int macroEntryCounter;
for (macroEntryCounter = 0; macroEntryCounter < array->num_entries; macroEntryCounter++) {
amqp_field_value_t *entry = &array->entries[macroEntryCounter];
switch (entry->kind) {
case AMQP_FIELD_KIND_TABLE:
php_amqp_type_free_amqp_table_internal(&entry->value.table, 0);
break;
case AMQP_FIELD_KIND_ARRAY:
php_amqp_type_free_amqp_array_internal(&entry->value.array);
break;
case AMQP_FIELD_KIND_UTF8:
if (entry->value.bytes.bytes) {
efree(entry->value.bytes.bytes);
}
break;
//
default:
break;
}
}
if (array->entries) {
efree(array->entries);
}
}
static void php_amqp_type_free_amqp_table_internal(amqp_table_t *object, bool clear_root)
{
if (!object) {
return;
}
if (object->entries) {
int macroEntryCounter;
for (macroEntryCounter = 0; macroEntryCounter < object->num_entries; macroEntryCounter++) {
amqp_table_entry_t *entry = &object->entries[macroEntryCounter];
efree(entry->key.bytes);
switch (entry->value.kind) {
case AMQP_FIELD_KIND_TABLE:
php_amqp_type_free_amqp_table_internal(&entry->value.value.table, 0);
break;
case AMQP_FIELD_KIND_ARRAY:
php_amqp_type_free_amqp_array_internal(&entry->value.value.array);
break;
case AMQP_FIELD_KIND_UTF8:
if (entry->value.value.bytes.bytes) {
efree(entry->value.value.bytes.bytes);
}
break;
default:
break;
}
}
efree(object->entries);
}
if (clear_root) {
efree(object);
}
}
void php_amqp_type_free_amqp_table(amqp_table_t *object) { php_amqp_type_free_amqp_table_internal(object, 1); }
diff --git a/amqp-2.1.0/amqp_type.h b/amqp-2.1.1/amqp_type.h
similarity index 100%
rename from amqp-2.1.0/amqp_type.h
rename to amqp-2.1.1/amqp_type.h
diff --git a/amqp-2.1.0/amqp_value.c b/amqp-2.1.1/amqp_value.c
similarity index 100%
rename from amqp-2.1.0/amqp_value.c
rename to amqp-2.1.1/amqp_value.c
diff --git a/amqp-2.1.0/amqp_value.h b/amqp-2.1.1/amqp_value.h
similarity index 100%
rename from amqp-2.1.0/amqp_value.h
rename to amqp-2.1.1/amqp_value.h
diff --git a/amqp-2.1.0/benchmark.php b/amqp-2.1.1/benchmark.php
similarity index 100%
rename from amqp-2.1.0/benchmark.php
rename to amqp-2.1.1/benchmark.php
diff --git a/amqp-2.1.0/config.m4 b/amqp-2.1.1/config.m4
similarity index 98%
rename from amqp-2.1.0/config.m4
rename to amqp-2.1.1/config.m4
index 3e33d57..94624fa 100644
--- a/amqp-2.1.0/config.m4
+++ b/amqp-2.1.1/config.m4
@@ -1,168 +1,167 @@
dnl config.m4 for extension amqp
PHP_ARG_WITH(amqp, for amqp support,
[ --with-amqp Include amqp support])
PHP_ARG_WITH(librabbitmq-dir, for amqp,
[ --with-librabbitmq-dir[=DIR] Set the path to librabbitmq install prefix.], yes)
dnl Set test wrapper binary to ignore any local ini settings
-PHP_EXECUTABLE="\$(top_srcdir)/infra/tools/pamqp-php-cli-deterministic"
if test "$PHP_AMQP" != "no"; then
AC_MSG_CHECKING([for supported PHP versions])
PHP_REF_FOUND_VERSION=$PHP_VERSION
PHP_REF_FOUND_VERNUM=$PHP_VERSION_ID
if test -z "$PHP_REF_FOUND_VERNUM"; then
if test -z "$PHP_CONFIG"; then
AC_MSG_ERROR([php-config not found])
fi
PHP_REF_FOUND_VERSION=`${PHP_CONFIG} --version`
PHP_REF_FOUND_VERNUM=`${PHP_CONFIG} --vernum`
fi
if test "$PHP_REF_FOUND_VERNUM" -lt "50600"; then
AC_MSG_ERROR([PHP version not supported, >= 5.6 required, but $PHP_REF_FOUND_VERSION found])
else
AC_MSG_RESULT([supported ($PHP_REF_FOUND_VERSION)])
fi
AC_MSG_RESULT($PHP_AMQP)
dnl # --with-amqp -> check with-path
NEW_LAYOUT=rabbitmq-c/framing.h
OLD_LAYOUT=amqp_framing.h
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
HAVE_LIBRABBITMQ_NEW_LAYOUT=0
if test "$PHP_LIBRABBITMQ_DIR" = "yes" -a -x $PKG_CONFIG; then
AC_MSG_CHECKING([for amqp using pkg-config])
if ! $PKG_CONFIG --exists librabbitmq ; then
AC_MSG_ERROR([librabbitmq not found])
fi
LIBRABBITMQ_VERSION=`$PKG_CONFIG librabbitmq --modversion`
AC_MSG_RESULT([found version $LIBRABBITMQ_VERSION])
if ! $PKG_CONFIG librabbitmq --atleast-version 0.8.0 ; then
AC_MSG_ERROR([librabbitmq must be version 0.8.0 or greater])
fi
if ! $PKG_CONFIG librabbitmq --atleast-version 0.10.0 ; then
AC_MSG_WARN([librabbitmq 0.10.0 or greater recommended, current version is $LIBRABBITMQ_VERSION])
fi
if test -r `$PKG_CONFIG librabbitmq --variable=includedir`/$NEW_LAYOUT; then
HAVE_LIBRABBITMQ_NEW_LAYOUT=1
fi
PHP_AMQP_LIBS=`$PKG_CONFIG librabbitmq --libs`
PHP_AMQP_INCS=`$PKG_CONFIG librabbitmq --cflags`
PHP_EVAL_LIBLINE($PHP_AMQP_LIBS, AMQP_SHARED_LIBADD)
PHP_EVAL_INCLINE($PHP_AMQP_INCS)
else
AC_MSG_CHECKING([for amqp files in default path])
if test "$PHP_LIBRABBITMQ_DIR" != "no" && test "$PHP_LIBRABBITMQ_DIR" != "yes"; then
for i in $PHP_LIBRABBITMQ_DIR; do
if test -r $i/include/$NEW_LAYOUT; then
AMQP_DIR=$i
HAVE_LIBRABBITMQ_NEW_LAYOUT=1
AC_MSG_RESULT(found in $i)
break
fi
if test -r $i/include/$OLD_LAYOUT; then
AMQP_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
else
for i in $PHP_AMQP /usr/local /usr ; do
if test -r $i/include/$NEW_LAYOUT; then
AMQP_DIR=$i
HAVE_LIBRABBITMQ_NEW_LAYOUT=1
AC_MSG_RESULT(found in $i)
break
fi
if test -r $i/include/$OLD_LAYOUT; then
AMQP_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
if test -z "$AMQP_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the librabbitmq distribution itself or (re)install librabbitmq development package if it available in your system])
fi
dnl # --with-amqp -> add include path
PHP_ADD_INCLUDE($AMQP_DIR/include)
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$AMQP_DIR/include"
AC_CACHE_CHECK(for librabbitmq version, ac_cv_librabbitmq_version, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include "amqp.h"
#include <stdio.h>
int main ()
{
FILE *testfile = fopen("conftestval", "w");
if (NULL == testfile) {
return 1;
}
fprintf(testfile, "%s\n", AMQ_VERSION_STRING);
fclose(testfile);
return 0;
}
]])],[ac_cv_librabbitmq_version=`cat ./conftestval`],[ac_cv_librabbitmq_version=NONE],[ac_cv_librabbitmq_version=NONE])
])
CFLAGS=$old_CFLAGS
if test "$ac_cv_librabbitmq_version" != "NONE"; then
ac_IFS=$IFS
IFS=.
set $ac_cv_librabbitmq_version
IFS=$ac_IFS
LIBRABBITMQ_API_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
if test "$LIBRABBITMQ_API_VERSION" -lt 8000 ; then
AC_MSG_ERROR([librabbitmq must be version 0.8.0 or greater, $ac_cv_librabbitmq_version version given instead])
fi
if test "$LIBRABBITMQ_API_VERSION" -lt 10000 ; then
AC_MSG_WARN([librabbitmq 0.10.0 or greater recommended, current version is $ac_cv_librabbitmq_version])
fi
else
AC_MSG_ERROR([could not determine librabbitmq version])
fi
dnl # --with-amqp -> check for lib and symbol presence
LIBNAME=rabbitmq
LIBSYMBOL=rabbitmq
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $AMQP_DIR/$PHP_LIBDIR, AMQP_SHARED_LIBADD)
fi
AC_MSG_CHECKING([for new librabbitmq layout])
AC_MSG_RESULT([${HAVE_LIBRABBITMQ_NEW_LAYOUT}])
AC_DEFINE_UNQUOTED(HAVE_LIBRABBITMQ_NEW_LAYOUT, ${HAVE_LIBRABBITMQ_NEW_LAYOUT}, ["Librabbitmq new layout"])
PHP_SUBST(AMQP_SHARED_LIBADD)
AMQP_SOURCES="amqp.c amqp_envelope_exception.c amqp_type.c amqp_exchange.c amqp_queue.c amqp_connection.c amqp_connection_resource.c amqp_channel.c amqp_envelope.c amqp_basic_properties.c amqp_methods_handling.c amqp_value.c amqp_timestamp.c amqp_decimal.c"
PHP_NEW_EXTENSION(amqp, $AMQP_SOURCES, $ext_shared)
fi
diff --git a/amqp-2.1.0/config.w32 b/amqp-2.1.1/config.w32
similarity index 100%
rename from amqp-2.1.0/config.w32
rename to amqp-2.1.1/config.w32
diff --git a/amqp-2.1.0/php_amqp.h b/amqp-2.1.1/php_amqp.h
similarity index 99%
rename from amqp-2.1.0/php_amqp.h
rename to amqp-2.1.1/php_amqp.h
index 03337a6..4592aad 100644
--- a/amqp-2.1.0/php_amqp.h
+++ b/amqp-2.1.1/php_amqp.h
@@ -1,465 +1,465 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev akalend@mail.ru Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifndef PHP_AMQP_H
#define PHP_AMQP_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdbool.h>
/* True global resources - no need for thread safety here */
extern zend_class_entry *amqp_exception_class_entry, *amqp_connection_exception_class_entry,
*amqp_channel_exception_class_entry, *amqp_exchange_exception_class_entry, *amqp_queue_exception_class_entry,
*amqp_value_exception_class_entry;
typedef struct _amqp_connection_resource amqp_connection_resource;
typedef struct _amqp_connection_object amqp_connection_object;
typedef struct _amqp_channel_object amqp_channel_object;
typedef struct _amqp_channel_resource amqp_channel_resource;
typedef struct _amqp_channel_callbacks amqp_channel_callbacks;
typedef struct _amqp_callback_bucket amqp_callback_bucket;
#if HAVE_LIBRABBITMQ_NEW_LAYOUT
#include <rabbitmq-c/amqp.h>
#else
#include <amqp.h>
#endif
extern zend_module_entry amqp_module_entry;
#define phpext_amqp_ptr &amqp_module_entry
#ifdef PHP_WIN32
#define PHP_AMQP_API __declspec(dllexport)
#else
#define PHP_AMQP_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include "php_amqp_version.h"
#if PHP_VERSION_ID >= 80000
#define PHP_AMQP_COMPAT_OBJ_P(zv) Z_OBJ_P(zv)
#define PHP_AMQP_DECLARE_PROPERTY_TYPE(type, nullable) (zend_type) ZEND_TYPE_INIT_CODE(type, nullable, 0)
#define PHP_AMQP_DECLARE_PROPERTY_OBJ_TYPE(class_name, nullable) \
(zend_type) ZEND_TYPE_INIT_CLASS(class_name, nullable, 0)
#else
#define PHP_AMQP_COMPAT_OBJ_P(zv) (zv)
#define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \
ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null)
#define PHP_AMQP_DECLARE_PROPERTY_TYPE(type, nullable) ZEND_TYPE_ENCODE(type, nullable)
#define PHP_AMQP_DECLARE_PROPERTY_OBJ_TYPE(class_name, nullable) ZEND_TYPE_ENCODE_CLASS(class_name, nullable)
#define RETURN_THROWS() \
do { \
ZEND_ASSERT(EG(exception)); \
(void) return_value; \
return; \
} while (0)
#endif
#if PHP_VERSION_ID < 80200
#define zend_ini_parse_quantity_warn(v, name) (zend_atol(ZSTR_VAL(v), ZSTR_LEN(v)))
#endif
#define PHP_AMQP_NULLABLE_DEFAULT_INIT(val, nullable) \
zval val; \
if (nullable) { \
ZVAL_NULL(&val); \
} else { \
ZVAL_UNDEF(&val); \
}
#define PHP_AMQP_DECLARE_TYPED_PROPERTY_ZVAL(class_entry, name, flags, type_info, val) \
{ \
zend_string *__name = zend_string_init(ZEND_STRL(name), 1); \
zend_declare_typed_property(class_entry, __name, &(val), flags, NULL, type_info); \
zend_string_release(__name); \
}
#define PHP_AMQP_DECLARE_TYPED_PROPERTY(class_entry, name, flags, type, nullable) \
{ \
PHP_AMQP_NULLABLE_DEFAULT_INIT(__val, nullable); \
PHP_AMQP_DECLARE_TYPED_PROPERTY_ZVAL( \
class_entry, \
name, \
flags, \
PHP_AMQP_DECLARE_PROPERTY_TYPE(type, nullable), \
__val \
) \
}
#define PHP_AMQP_DECLARE_TYPED_PROPERTY_WITH_DEFAULT(class_entry, name, flags, type, nullable, init) \
{ \
zval __val; \
ZVAL_UNDEF(&__val); \
init(&__val); \
PHP_AMQP_DECLARE_TYPED_PROPERTY_ZVAL( \
class_entry, \
name, \
flags, \
PHP_AMQP_DECLARE_PROPERTY_TYPE(type, nullable), \
__val \
) \
}
#define PHP_AMQP_DECLARE_TYPED_PROPERTY_OBJ(class_entry, name, flags, class_name, nullable) \
{ \
PHP_AMQP_NULLABLE_DEFAULT_INIT(__val, nullable); \
zend_string *__class_name = zend_string_init(ZEND_STRL(#class_name), 1); \
PHP_AMQP_DECLARE_TYPED_PROPERTY_ZVAL( \
class_entry, \
name, \
flags, \
PHP_AMQP_DECLARE_PROPERTY_OBJ_TYPE(__class_name, nullable), \
__val \
); \
}
#include "amqp_connection_resource.h"
#define AMQP_NOPARAM 0
/* Where is 1?*/
#define AMQP_JUST_CONSUME 1
#define AMQP_DURABLE 2
#define AMQP_PASSIVE 4
#define AMQP_EXCLUSIVE 8
#define AMQP_AUTODELETE 16
#define AMQP_INTERNAL 32
#define AMQP_NOLOCAL 64
#define AMQP_AUTOACK 128
#define AMQP_IFEMPTY 256
#define AMQP_IFUNUSED 512
#define AMQP_MANDATORY 1024
#define AMQP_IMMEDIATE 2048
#define AMQP_MULTIPLE 4096
#define AMQP_NOWAIT 8192
#define AMQP_REQUEUE 16384
/* passive, durable, auto-delete, internal, no-wait (see https://www.rabbitmq.com/amqp-0-9-1-reference.html#exchange.declare) */
#define PHP_AMQP_EXCHANGE_FLAGS (AMQP_PASSIVE | AMQP_DURABLE | AMQP_AUTODELETE | AMQP_INTERNAL)
/* passive, durable, exclusive, auto-delete, no-wait (see https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare) */
/* We don't support no-wait flag */
#define PHP_AMQP_QUEUE_FLAGS (AMQP_PASSIVE | AMQP_DURABLE | AMQP_EXCLUSIVE | AMQP_AUTODELETE)
#define AMQP_EX_TYPE_DIRECT "direct"
#define AMQP_EX_TYPE_FANOUT "fanout"
#define AMQP_EX_TYPE_TOPIC "topic"
#define AMQP_EX_TYPE_HEADERS "headers"
#define PHP_AMQP_CONNECTION_RES_NAME "AMQP Connection Resource"
struct _amqp_channel_resource {
char is_connected;
amqp_channel_t channel_id;
amqp_connection_resource *connection_resource;
amqp_channel_object *parent;
};
struct _amqp_callback_bucket {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
};
struct _amqp_channel_callbacks {
amqp_callback_bucket basic_return;
amqp_callback_bucket basic_ack;
amqp_callback_bucket basic_nack;
};
/* NOTE: due to how internally PHP works with custom object, zend_object position in structure matters */
struct _amqp_channel_object {
amqp_channel_callbacks callbacks;
zval *gc_data;
int gc_data_count;
amqp_channel_resource *channel_resource;
zend_object zo;
};
struct _amqp_connection_resource {
bool is_connected;
bool is_persistent;
bool is_dirty;
zend_resource *resource;
amqp_connection_object *parent;
amqp_channel_t max_slots;
amqp_channel_t used_slots;
amqp_channel_resource **slots;
amqp_connection_state_t connection_state;
amqp_socket_t *socket;
};
struct _amqp_connection_object {
amqp_connection_resource *connection_resource;
zend_object zo;
};
#define DEFAULT_PORT "5672" /* default AMQP port */
#define DEFAULT_HOST "localhost"
#define DEFAULT_TIMEOUT ""
#define DEFAULT_READ_TIMEOUT "0"
#define DEFAULT_WRITE_TIMEOUT "0"
#define DEFAULT_CONNECT_TIMEOUT "0"
#define DEFAULT_RPC_TIMEOUT "0"
#define DEFAULT_VHOST "/"
#define DEFAULT_LOGIN "guest"
#define DEFAULT_PASSWORD "guest"
#define DEFAULT_AUTOACK "0" /* These are all strings to facilitate setting default ini values */
#define DEFAULT_PREFETCH_COUNT "3"
#define DEFAULT_PREFETCH_SIZE "0"
#define DEFAULT_GLOBAL_PREFETCH_COUNT "0"
#define DEFAULT_GLOBAL_PREFETCH_SIZE "0"
#define DEFAULT_SASL_METHOD AMQP_SASL_METHOD_PLAIN
/* Usually, default is 0 which means 65535, but underlying rabbitmq-c library pool allocates minimal pool for each channel,
* so it takes a lot of memory to keep all that channels. Even after channel closing that buffer still keep memory allocation.
*/
/* #define DEFAULT_CHANNELS_PER_CONNECTION AMQP_DEFAULT_MAX_CHANNELS */
#define PHP_AMQP_PROTOCOL_MAX_CHANNELS 256
/* AMQP_DEFAULT_FRAME_SIZE 131072 */
#if PHP_AMQP_PROTOCOL_MAX_CHANNELS > 0
#define PHP_AMQP_MAX_CHANNELS PHP_AMQP_PROTOCOL_MAX_CHANNELS
#else
#define PHP_AMQP_MAX_CHANNELS \
65535// Note that the maximum number of channels the protocol supports is 65535 (2^16, with the 0-channel reserved)
#endif
#define PHP_AMQP_MAX_FRAME_SIZE INT_MAX
#define PHP_AMQP_MAX_HEARTBEAT INT_MAX
#define PHP_AMQP_MAX_CREDENTIALS_LENGTH 1024
#define PHP_AMQP_MAX_IDENTIFIER_LENGTH 512
#define PHP_AMQP_MIN_PORT 1
#define PHP_AMQP_MAX_PORT 65535
#define PHP_AMQP_MAX_PREFETCH_COUNT UINT16_MAX
#define PHP_AMQP_MAX_PREFETCH_SIZE UINT32_MAX
#define PHP_AMQP_DEFAULT_CHANNEL_MAX PHP_AMQP_MAX_CHANNELS
#define PHP_AMQP_DEFAULT_FRAME_MAX AMQP_DEFAULT_FRAME_SIZE
#define PHP_AMQP_DEFAULT_HEARTBEAT AMQP_DEFAULT_HEARTBEAT
#define PHP_AMQP_STRINGIFY(value) PHP_AMQP_TO_STRING(value)
#define PHP_AMQP_TO_STRING(value) #value
#define DEFAULT_CHANNEL_MAX PHP_AMQP_STRINGIFY(PHP_AMQP_MAX_CHANNELS)
#define DEFAULT_FRAME_MAX PHP_AMQP_STRINGIFY(PHP_AMQP_DEFAULT_FRAME_MAX)
#define DEFAULT_HEARTBEAT PHP_AMQP_STRINGIFY(PHP_AMQP_DEFAULT_HEARTBEAT)
#define DEFAULT_CACERT ""
#define DEFAULT_CERT ""
#define DEFAULT_KEY ""
#define DEFAULT_VERIFY "1"
#define DEFAULT_SERIALIZATION_DEPTH "128"
#define IS_PASSIVE(bitmask) (AMQP_PASSIVE & (bitmask)) ? 1 : 0
#define IS_DURABLE(bitmask) (AMQP_DURABLE & (bitmask)) ? 1 : 0
#define IS_EXCLUSIVE(bitmask) (AMQP_EXCLUSIVE & (bitmask)) ? 1 : 0
#define IS_AUTODELETE(bitmask) (AMQP_AUTODELETE & (bitmask)) ? 1 : 0
#define IS_INTERNAL(bitmask) (AMQP_INTERNAL & (bitmask)) ? 1 : 0
#define PHP_AMQP_NOPARAMS() \
if (zend_parse_parameters_none() == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
}
#define PHP_AMQP_RETURN_THIS_PROP(prop_name) \
zval *_zv = zend_read_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL(prop_name), 0, &rv); \
RETURN_ZVAL(_zv, 1, 0);
#define PHP_AMQP_READ_OBJ_PROP(cls, obj, name) \
zend_read_property((cls), PHP_AMQP_COMPAT_OBJ_P(obj), ZEND_STRL(name), 0, &rv)
#define PHP_AMQP_READ_OBJ_PROP_DOUBLE(cls, obj, name) Z_DVAL_P(PHP_AMQP_READ_OBJ_PROP((cls), (obj), (name)))
#define PHP_AMQP_READ_THIS_PROP_CE(name, ce) \
zend_read_property((ce), PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL(name), 0, &rv)
#define PHP_AMQP_READ_THIS_PROP(name) \
zend_read_property(this_ce, PHP_AMQP_COMPAT_OBJ_P(getThis()), ZEND_STRL(name), 0, &rv)
#define PHP_AMQP_READ_THIS_PROP_BOOL(name) Z_TYPE_P(PHP_AMQP_READ_THIS_PROP(name)) == IS_TRUE
#define PHP_AMQP_READ_THIS_PROP_STR(name) Z_STRVAL_P(PHP_AMQP_READ_THIS_PROP(name))
#define PHP_AMQP_READ_THIS_PROP_STRLEN(name) \
(Z_TYPE_P(PHP_AMQP_READ_THIS_PROP(name)) == IS_STRING ? Z_STRLEN_P(PHP_AMQP_READ_THIS_PROP(name)) : 0)
#define PHP_AMQP_READ_THIS_PROP_ARR(name) Z_ARRVAL_P(PHP_AMQP_READ_THIS_PROP(name))
#define PHP_AMQP_READ_THIS_PROP_LONG(name) Z_LVAL_P(PHP_AMQP_READ_THIS_PROP(name))
#define PHP_AMQP_READ_THIS_PROP_DOUBLE(name) Z_DVAL_P(PHP_AMQP_READ_THIS_PROP(name))
static inline amqp_connection_object *php_amqp_connection_object_fetch(zend_object *obj)
{
return (amqp_connection_object *) ((char *) obj - XtOffsetOf(amqp_connection_object, zo));
}
static inline amqp_channel_object *php_amqp_channel_object_fetch(zend_object *obj)
{
return (amqp_channel_object *) ((char *) obj - XtOffsetOf(amqp_channel_object, zo));
}
#define PHP_AMQP_GET_CONNECTION(obj) php_amqp_connection_object_fetch(Z_OBJ_P(obj))
#define PHP_AMQP_GET_CHANNEL(obj) php_amqp_channel_object_fetch(Z_OBJ_P(obj))
#define PHP_AMQP_FETCH_CONNECTION(obj) php_amqp_connection_object_fetch(obj)
#define PHP_AMQP_FETCH_CHANNEL(obj) php_amqp_channel_object_fetch(obj)
#define PHP_AMQP_GET_CHANNEL_RESOURCE(obj) \
(IS_OBJECT == Z_TYPE_P(obj) ? (PHP_AMQP_GET_CHANNEL(obj))->channel_resource : NULL)
#define PHP_AMQP_VERIFY_CONNECTION_ERROR(error, reason) \
char verify_connection_error_tmp[255]; \
snprintf(verify_connection_error_tmp, 255, "%s %s", error, reason); \
zend_throw_exception(amqp_connection_exception_class_entry, verify_connection_error_tmp, 0); \
return;
#define PHP_AMQP_VERIFY_CONNECTION(connection, error) \
if (!connection) { \
PHP_AMQP_VERIFY_CONNECTION_ERROR(error, "Stale reference to the connection object.") \
} \
if (!(connection)->connection_resource || !(connection)->connection_resource->is_connected) { \
PHP_AMQP_VERIFY_CONNECTION_ERROR(error, "No connection available.") \
}
#define PHP_AMQP_VERIFY_CHANNEL_ERROR(error, reason) \
char verify_channel_error_tmp[255]; \
snprintf(verify_channel_error_tmp, 255, "%s %s", error, reason); \
zend_throw_exception(amqp_channel_exception_class_entry, verify_channel_error_tmp, 0); \
return;
#define PHP_AMQP_VERIFY_CHANNEL_RESOURCE(resource, error) \
if (!resource) { \
PHP_AMQP_VERIFY_CHANNEL_ERROR(error, "Stale reference to the channel object.") \
} \
if (!(resource)->is_connected) { \
PHP_AMQP_VERIFY_CHANNEL_ERROR(error, "No channel available.") \
} \
if (!(resource)->connection_resource) { \
PHP_AMQP_VERIFY_CONNECTION_ERROR(error, "Stale reference to the connection object.") \
} \
if (!(resource)->connection_resource->is_connected) { \
PHP_AMQP_VERIFY_CONNECTION_ERROR(error, "No connection available.") \
}
#define PHP_AMQP_VERIFY_CHANNEL_CONNECTION_RESOURCE(resource, error) \
if (!resource) { \
PHP_AMQP_VERIFY_CHANNEL_ERROR(error, "Stale reference to the channel object.") \
} \
if (!(resource)->connection_resource) { \
PHP_AMQP_VERIFY_CONNECTION_ERROR(error, "Stale reference to the connection object.") \
} \
if (!(resource)->connection_resource->is_connected) { \
PHP_AMQP_VERIFY_CONNECTION_ERROR(error, "No connection available.") \
}
#define PHP_AMQP_MAYBE_ERROR(res, channel_resource) \
((AMQP_RESPONSE_NORMAL != (res).reply_type) && \
PHP_AMQP_RESOURCE_RESPONSE_OK != \
php_amqp_error(res, &PHP_AMQP_G(error_message), (channel_resource)->connection_resource, (channel_resource)))
#if ZEND_MODULE_API_NO >= 20100000
#define AMQP_OBJECT_PROPERTIES_INIT(obj, ce) object_properties_init(&(obj), ce);
#else
#define AMQP_OBJECT_PROPERTIES_INIT(obj, ce) \
do { \
zval *tmp; \
zend_hash_copy( \
(obj).properties, \
&(ce)->default_properties, \
(copy_ctor_func_t) zval_add_ref, \
(void *) &tmp, \
sizeof(zval *) \
); \
} while (0);
#endif
#define AMQP_ERROR_CATEGORY_MASK (1 << 29)
#define PHP_AMQP_RECURSION_DEPTH_LIMIT (1 << 7)
#ifdef PHP_WIN32
#define AMQP_OS_SOCKET_TIMEOUT_ERRNO AMQP_ERROR_CATEGORY_MASK | WSAETIMEDOUT
#else
#define AMQP_OS_SOCKET_TIMEOUT_ERRNO AMQP_ERROR_CATEGORY_MASK | EAGAIN
#endif
ZEND_BEGIN_MODULE_GLOBALS(amqp)
char *error_message;
zend_long error_code;
zend_long deserialization_depth;
zend_long serialization_depth;
ZEND_END_MODULE_GLOBALS(amqp)
ZEND_EXTERN_MODULE_GLOBALS(amqp)
#ifdef ZEND_MODULE_GLOBALS_ACCESSOR
#define PHP_AMQP_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(amqp, v)
#if defined(ZTS) && defined(COMPILE_DL_WEAK)
ZEND_TSRMLS_CACHE_EXTERN();
#endif
#else
#ifdef ZTS
#define PHP_AMQP_G(v) TSRMG(amqp_globals_id, zend_amqp_globals *, v)
#else
#define PHP_AMQP_G(v) (amqp_globals.v)
#endif
#endif
int php_amqp_error(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *connection_resource,
amqp_channel_resource *channel_resource
);
int php_amqp_error_advanced(
amqp_rpc_reply_t reply,
char **message,
amqp_connection_resource *connection_resource,
amqp_channel_resource *channel_resource,
int fail_on_errors
);
/**
* @deprecated
*/
void php_amqp_zend_throw_exception(
amqp_rpc_reply_t reply,
zend_class_entry *exception_ce,
const char *message,
zend_long code
);
void php_amqp_zend_throw_exception_short(amqp_rpc_reply_t reply, zend_class_entry *exception_ce);
void php_amqp_maybe_release_buffers_on_channel(
amqp_connection_resource *connection_resource,
amqp_channel_resource *channel_resource
);
bool php_amqp_is_valid_identifier(zend_string *val);
bool php_amqp_is_valid_credential(zend_string *val);
bool php_amqp_is_valid_port(zend_long val);
bool php_amqp_is_valid_timeout(double timeout);
bool php_amqp_is_valid_channel_max(zend_long val);
bool php_amqp_is_valid_frame_size_max(zend_long val);
bool php_amqp_is_valid_heartbeat(zend_long val);
bool php_amqp_is_valid_prefetch_count(zend_long val);
bool php_amqp_is_valid_prefetch_size(zend_long val);
#endif /* PHP_AMQP_H */
diff --git a/amqp-2.1.0/php_amqp_version.h b/amqp-2.1.1/php_amqp_version.h
similarity index 50%
rename from amqp-2.1.0/php_amqp_version.h
rename to amqp-2.1.1/php_amqp_version.h
index 64253f5..1358f86 100644
--- a/amqp-2.1.0/php_amqp_version.h
+++ b/amqp-2.1.1/php_amqp_version.h
@@ -1,6 +1,6 @@
#define PHP_AMQP_VERSION_MAJOR 2
#define PHP_AMQP_VERSION_MINOR 1
-#define PHP_AMQP_VERSION_PATCH 0
+#define PHP_AMQP_VERSION_PATCH 1
#define PHP_AMQP_VERSION_EXTRA ""
-#define PHP_AMQP_VERSION "2.1.0"
-#define PHP_AMQP_VERSION_ID 20100
+#define PHP_AMQP_VERSION "2.1.1"
+#define PHP_AMQP_VERSION_ID 20101
diff --git a/amqp-2.1.0/stubs/AMQP.php b/amqp-2.1.1/stubs/AMQP.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQP.php
rename to amqp-2.1.1/stubs/AMQP.php
diff --git a/amqp-2.1.0/stubs/AMQPBasicProperties.php b/amqp-2.1.1/stubs/AMQPBasicProperties.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPBasicProperties.php
rename to amqp-2.1.1/stubs/AMQPBasicProperties.php
diff --git a/amqp-2.1.0/stubs/AMQPChannel.php b/amqp-2.1.1/stubs/AMQPChannel.php
similarity index 98%
rename from amqp-2.1.0/stubs/AMQPChannel.php
rename to amqp-2.1.1/stubs/AMQPChannel.php
index 5ce1142..59bdc74 100644
--- a/amqp-2.1.0/stubs/AMQPChannel.php
+++ b/amqp-2.1.1/stubs/AMQPChannel.php
@@ -1,309 +1,309 @@
<?php
/**
* stub class representing AMQPChannel from pecl-amqp
*/
class AMQPChannel
{
private AMQPConnection $connection;
private ?int $prefetchCount = null;
private ?int $prefetchSize;
private ?int $globalPrefetchCount;
private ?int $globalPrefetchSize;
private array $consumers = [];
/**
* Create an instance of an AMQPChannel object.
*
* @param AMQPConnection $connection An instance of AMQPConnection
* with an active connection to a
* broker.
*
* @throws AMQPConnectionException If the connection to the broker
* was lost.
*/
public function __construct(AMQPConnection $connection)
{
}
/**
* Commit a pending transaction.
*
* @throws AMQPChannelException If no transaction was started prior to
* calling this method.
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function commitTransaction(): void
{
}
/**
* Check the channel connection.
*
* @return bool Indicates whether the channel is connected.
*/
public function isConnected(): bool
{
}
/**
* Closes the channel.
*/
public function close(): void
{
}
/**
* Return internal channel ID
*
* @return integer
*/
public function getChannelId(): int
{
}
/**
* Set the Quality Of Service settings for the given channel.
*
* Specify the amount of data to prefetch in terms of window size (octets)
* or number of messages from a queue during a AMQPQueue::consume() or
* AMQPQueue::get() method call. The client will prefetch data up to size
* octets or count messages from the server, whichever limit is hit first.
* Setting either value to 0 will instruct the client to ignore that
* particular setting. A call to AMQPChannel::qos() will overwrite any
* values set by calling AMQPChannel::setPrefetchSize() and
* AMQPChannel::setPrefetchCount(). If the call to either
* AMQPQueue::consume() or AMQPQueue::get() is done with the AMQP_AUTOACK
* flag set, the client will not do any prefetching of data, regardless of
* the QOS settings.
*
* @param integer $size The window size, in octets, to prefetch.
* @param integer $count The number of messages to prefetch.
* @param bool $global TRUE for global, FALSE for consumer. FALSE by default.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function qos(int $size, int $count, bool $global = false): void
{
}
/**
* Rollback a transaction.
*
* Rollback an existing transaction. AMQPChannel::startTransaction() must
* be called prior to this.
*
* @throws AMQPChannelException If no transaction was started prior to
* calling this method.
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function rollbackTransaction(): void
{
}
/**
* Set the number of messages to prefetch from the broker for each consumer.
*
* Set the number of messages to prefetch from the broker during a call to
* AMQPQueue::consume() or AMQPQueue::get().
*
* @param integer $count The number of messages to prefetch.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function setPrefetchCount(int $count): void
{
}
/**
* Get the number of messages to prefetch from the broker for each consumer.
*
* @return integer
*/
public function getPrefetchCount(): int
{
}
/**
* Set the window size to prefetch from the broker for each consumer.
*
* Set the prefetch window size, in octets, during a call to
* AMQPQueue::consume() or AMQPQueue::get(). Any call to this method will
* automatically set the prefetch message count to 0, meaning that the
* prefetch message count setting will be ignored. If the call to either
* AMQPQueue::consume() or AMQPQueue::get() is done with the AMQP_AUTOACK
* flag set, this setting will be ignored.
*
* @param integer $size The window size, in octets, to prefetch.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function setPrefetchSize(int $size): void
{
}
/**
* Get the window size to prefetch from the broker for each consumer.
*
* @return integer
*/
public function getPrefetchSize(): int
{
}
/**
* Set the number of messages to prefetch from the broker across all consumers.
*
* Set the number of messages to prefetch from the broker during a call to
* AMQPQueue::consume() or AMQPQueue::get().
*
* @param integer $count The number of messages to prefetch.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function setGlobalPrefetchCount(int $count): void
{
}
/**
* Get the number of messages to prefetch from the broker across all consumers.
*
* @return integer
*/
public function getGlobalPrefetchCount(): int
{
}
/**
* Set the window size to prefetch from the broker for all consumers.
*
* Set the prefetch window size, in octets, during a call to
* AMQPQueue::consume() or AMQPQueue::get(). Any call to this method will
* automatically set the prefetch message count to 0, meaning that the
* prefetch message count setting will be ignored. If the call to either
* AMQPQueue::consume() or AMQPQueue::get() is done with the AMQP_AUTOACK
* flag set, this setting will be ignored.
*
* @param integer $size The window size, in octets, to prefetch.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function setGlobalPrefetchSize(int $size): void
{
}
/**
* Get the window size to prefetch from the broker for all consumers.
*
* @return integer
*/
public function getGlobalPrefetchSize(): int
{
}
/**
* Start a transaction.
*
* This method must be called on the given channel prior to calling
* AMQPChannel::commitTransaction() or AMQPChannel::rollbackTransaction().
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function startTransaction(): void
{
}
/**
* Get the AMQPConnection object in use
*/
public function getConnection(): AMQPConnection
{
}
/**
* Redeliver unacknowledged messages.
*/
public function basicRecover(bool $requeue = true): void
{
}
/**
* Set the channel to use publisher acknowledgements. This can only used on a non-transactional channel.
*/
public function confirmSelect(): void
{
}
/**
* Set callback to process basic.ack and basic.nac AMQP server methods (applicable when channel in confirm mode).
*
* Callback functions with all arguments have the following signature:
*
* function ack_callback(int $delivery_tag, bool $multiple) : bool;
* function nack_callback(int $delivery_tag, bool $multiple, bool $requeue) : bool;
*
- * and should return boolean false when wait loop should be canceled.
+ * and should return boolean FALSE when wait loop should be canceled.
*
* Note, basic.nack server method will only be delivered if an internal error occurs in the Erlang process
* responsible for a queue (see https://www.rabbitmq.com/confirms.html for details).
*/
public function setConfirmCallback(?callable $ackCallback, callable $nackCallback = null): void
{
}
/**
* Wait until all messages published since the last call have been either ack'd or nack'd by the broker.
*
* Note, this method also catch all basic.return message from server.
*
* @param float $timeout Timeout in seconds. May be fractional.
*
* @throws AMQPQueueException If timeout occurs.
*/
public function waitForConfirm(float $timeout = 0.0): void
{
}
/**
* Set callback to process basic.return AMQP server method
*
* Callback function with all arguments has the following signature:
*
* function callback(int $reply_code,
* string $reply_text,
* string $exchange,
* string $routing_key,
* AMQPBasicProperties $properties,
* string $body) : bool;
*
- * and should return boolean false when wait loop should be canceled.
+ * and should return boolean FALSE when wait loop should be canceled.
*/
public function setReturnCallback(?callable $returnCallback): void
{
}
/**
* Start wait loop for basic.return AMQP server methods
*
* @param float $timeout Timeout in seconds. May be fractional.
*
* @throws AMQPQueueException If timeout occurs.
*/
public function waitForBasicReturn(float $timeout = 0.0): void
{
}
/**
* Return array of current consumers where key is consumer and value is AMQPQueue consumer is running on
*
* @return AMQPQueue[]
*/
public function getConsumers(): array
{
}
}
diff --git a/amqp-2.1.0/stubs/AMQPChannelException.php b/amqp-2.1.1/stubs/AMQPChannelException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPChannelException.php
rename to amqp-2.1.1/stubs/AMQPChannelException.php
diff --git a/amqp-2.1.0/stubs/AMQPConnection.php b/amqp-2.1.1/stubs/AMQPConnection.php
similarity index 96%
rename from amqp-2.1.0/stubs/AMQPConnection.php
rename to amqp-2.1.1/stubs/AMQPConnection.php
index e5440f7..19c3a17 100644
--- a/amqp-2.1.0/stubs/AMQPConnection.php
+++ b/amqp-2.1.1/stubs/AMQPConnection.php
@@ -1,472 +1,472 @@
<?php
/**
* stub class representing AMQPConnection from pecl-amqp
*/
class AMQPConnection
{
private string $login;
private string $password;
private string $host;
private string $vhost;
private int $port;
private float $readTimeout;
private float $writeTimeout;
private float $connectTimeout;
private float $rpcTimeout;
private int $channelMax;
private int $frameMax;
private int $heartbeat;
private ?string $cacert;
private ?string $key;
private ?string $cert;
private bool $verify = true;
private int $saslMethod = AMQP_SASL_METHOD_PLAIN;
private ?string $connectionName;
/**
* Create an instance of AMQPConnection.
*
* Creates an AMQPConnection instance representing a connection to an AMQP
* broker. A connection will not be established until
* AMQPConnection::connect() is called.
*
* $credentials = array(
* 'host' => amqp.host The host to connect too. Note: Max 1024 characters.
* 'port' => amqp.port Port on the host.
* 'vhost' => amqp.vhost The virtual host on the host. Note: Max 128 characters.
* 'login' => amqp.login The login name to use. Note: Max 128 characters.
* 'password' => amqp.password Password. Note: Max 128 characters.
- * 'read_timeout' => Timeout in for income activity. Note: 0 or greater seconds. May be fractional.
- * 'write_timeout' => Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional.
+ * 'read_timeout' => Timeout in for consume. Note: 0 or greater seconds. May be fractional.
+ * 'write_timeout' => Timeout in for publish. Note: 0 or greater seconds. May be fractional.
* 'connect_timeout' => Connection timeout. Note: 0 or greater seconds. May be fractional.
- * 'rpc_timeout' => RPC timeout. Note: 0 or greater seconds. May be fractional.
+ * 'rpc_timeout' => Timeout for RPC-style AMQP methods. Note: 0 or greater seconds. May be fractional.
*
* Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details):
* 'channel_max' => Specifies highest channel number that the server permits. 0 means standard extension limit
* (see PHP_AMQP_MAX_CHANNELS constant)
* 'frame_max' => The largest frame size that the server proposes for the connection, including frame header
* and end-byte. 0 means standard extension limit (depends on librabbimq default frame size limit)
* 'heartbeat' => The delay, in seconds, of the connection heartbeat that the server wants.
* 0 means the server does not want a heartbeat. Note, librabbitmq has limited heartbeat support,
* which means heartbeats checked only during blocking calls.
*
* TLS support (see https://www.rabbitmq.com/ssl.html for details):
* 'cacert' => Path to the CA cert file in PEM format..
* 'cert' => Path to the client certificate in PEM foramt.
* 'key' => Path to the client key in PEM format.
* 'verify' => Enable or disable peer verification. If peer verification is enabled then the common name in the
* server certificate must match the server name. Peer verification is enabled by default.
*
* 'connection_name' => A user determined name for the connection
* )
*
* @param array $credentials Optional array of credential information for
* connecting to the AMQP broker.
*/
public function __construct(array $credentials = [])
{
}
/**
* Check whether the connection to the AMQP broker is still valid.
*
* Cannot reliably detect dropped connections or unusual socket errors, as it does not actively
* engage the socket.
*
- * @return boolean True if connected, false otherwise.
+ * @return boolean TRUE if connected, FALSE otherwise.
*/
public function isConnected(): bool
{
}
/**
* Whether connection persistent.
*
- * When no connection is established, it will always return false. The same disclaimer as for
+ * When no connection is established, it will always return FALSE. The same disclaimer as for
* {@see AMQPConnection::isConnected()} applies.
*
- * @return boolean True if persistently connected, false otherwise.
+ * @return boolean TRUE if persistently connected, FALSE otherwise.
*/
public function isPersistent(): bool
{
}
/**
* Establish a transient connection with the AMQP broker.
*
* This method will initiate a connection with the AMQP broker.
*
* @throws AMQPConnectionException
*/
public function connect(): void
{
}
/**
* Closes the transient connection with the AMQP broker.
*
* This method will close an open connection with the AMQP broker.
*
* @throws AMQPConnectionException When attempting to disconnect a persistent connection
*/
public function disconnect(): void
{
}
/**
* Close any open transient connections and initiate a new one with the AMQP broker.
*
* @throws AMQPConnectionException
*/
public function reconnect(): void
{
}
/**
* Establish a persistent connection with the AMQP broker.
*
* This method will initiate a connection with the AMQP broker
* or reuse an existing one if present.
*
* @throws AMQPConnectionException
*/
public function pconnect(): void
{
}
/**
* Closes a persistent connection with the AMQP broker.
*
* This method will close an open persistent connection with the AMQP
* broker.
*
* @throws AMQPConnectionException When attempting to disconnect a transient connection
*/
public function pdisconnect(): void
{
}
/**
* Close any open persistent connections and initiate a new one with the AMQP broker.
*
* @throws AMQPConnectionException
*/
public function preconnect(): void
{
}
/**
* Get the configured host.
*
* @return string The configured hostname of the broker
*/
public function getHost(): string
{
}
/**
* Get the configured login.
*
* @return string The configured login as a string.
*/
public function getLogin(): string
{
}
/**
* Get the configured password.
*
* @return string The configured password as a string.
*/
public function getPassword(): string
{
}
/**
* Get the configured port.
*
* @return int The configured port as an integer.
*/
public function getPort(): int
{
}
/**
* Get the configured vhost.
*
* @return string The configured virtual host as a string.
*/
public function getVhost(): string
{
}
/**
* Set the hostname used to connect to the AMQP broker.
*
* @param string $host The hostname of the AMQP broker.
*
* @throws AMQPConnectionException If host is longer then 1024 characters.
*/
public function setHost(string $host): void
{
}
/**
* Set the login string used to connect to the AMQP broker.
*
* @param string $login The login string used to authenticate
* with the AMQP broker.
*
* @throws AMQPConnectionException If login is longer then 32 characters.
*/
public function setLogin(string $login): void
{
}
/**
* Set the password string used to connect to the AMQP broker.
*
* @param string $password The password string used to authenticate
* with the AMQP broker.
*
* @throws AMQPConnectionException If password is longer then 32characters.
*/
public function setPassword(string $password): void
{
}
/**
* Set the port used to connect to the AMQP broker.
*
* @param integer $port The port used to connect to the AMQP broker.
*
* @throws AMQPConnectionException If port is longer not between
* 1 and 65535.
*/
public function setPort(int $port): void
{
}
/**
* Sets the virtual host to which to connect on the AMQP broker.
*
* @param string $vhost The virtual host to use on the AMQP
* broker.
*
* @throws AMQPConnectionException If host is longer then 32 characters.
*/
public function setVhost(string $vhost): void
{
}
/**
* Sets the interval of time to wait for income activity from AMQP broker
*
* @deprecated use AMQPConnection::setReadTimeout($timeout) instead
*
* @throws AMQPConnectionException If timeout is less than 0.
*/
public function setTimeout(float $timeout): void
{
}
/**
* Get the configured interval of time to wait for income activity
* from AMQP broker
*
* @deprecated use AMQPConnection::getReadTimeout() instead
*/
public function getTimeout(): float
{
}
/**
* Sets the interval of time (in seconds) to wait for income activity from AMQP broker
*
* @throws AMQPConnectionException If timeout is less than 0.
*/
public function setReadTimeout(float $timeout): void
{
}
/**
* Get the configured interval of time (in seconds) to wait for income activity
* from AMQP broker
*/
public function getReadTimeout(): float
{
}
/**
* Sets the interval of time (in seconds) to wait for outcome activity to AMQP broker
*
* @throws AMQPConnectionException If timeout is less than 0.
*/
public function setWriteTimeout(float $timeout): void
{
}
/**
* Get the configured interval of time (in seconds) to wait for outcome activity
* to AMQP broker
*/
public function getWriteTimeout(): float
{
}
/**
* Get the configured timeout (in seconds) for connecting to the AMQP broker
*/
public function getConnectTimeout(): float
{
}
/**
* Sets the interval of time to wait (in seconds) for RPC activity to AMQP broker
*
* @throws AMQPConnectionException If timeout is less than 0.
*/
public function setRpcTimeout(float $timeout): void
{
}
/**
* Get the configured interval of time (in seconds) to wait for RPC activity
* to AMQP broker
*/
public function getRpcTimeout(): float
{
}
/**
* Return last used channel id during current connection session.
*/
public function getUsedChannels(): int
{
}
/**
* Get the maximum number of channels the connection can handle.
*
* When connection is connected, effective connection value returned, which is normally the same as original
* correspondent value passed to constructor, otherwise original value passed to constructor returned.
*/
public function getMaxChannels(): int
{
}
/**
* Get max supported frame size per connection in bytes.
*
* When connection is connected, effective connection value returned, which is normally the same as original
* correspondent value passed to constructor, otherwise original value passed to constructor returned.
*/
public function getMaxFrameSize(): int
{
}
/**
* Get number of seconds between heartbeats of the connection in seconds.
*
* When connection is connected, effective connection value returned, which is normally the same as original
* correspondent value passed to constructor, otherwise original value passed to constructor returned.
*/
public function getHeartbeatInterval(): int
{
}
/**
* Get path to the CA cert file in PEM format
*/
public function getCACert(): ?string
{
}
/**
* Set path to the CA cert file in PEM format
*/
public function setCACert(?string $cacert): void
{
}
/**
* Get path to the client certificate in PEM format
*/
public function getCert(): ?string
{
}
/**
* Set path to the client certificate in PEM format
*/
public function setCert(?string $cert): void
{
}
/**
* Get path to the client key in PEM format
*/
public function getKey(): ?string
{
}
/**
* Set path to the client key in PEM format
*/
public function setKey(?string $key): void
{
}
/**
* Get whether peer verification enabled or disabled
*/
public function getVerify(): bool
{
}
/**
* Enable or disable peer verification
*/
public function setVerify(bool $verify): void
{
}
/**
* set authentication method
*
* @param int $saslMethod AMQP_SASL_METHOD_PLAIN | AMQP_SASL_METHOD_EXTERNAL
*/
public function setSaslMethod(int $saslMethod): void
{
}
public function getSaslMethod(): int
{
}
public function setConnectionName(?string $connectionName): void
{
}
public function getConnectionName(): ?string
{
}
}
diff --git a/amqp-2.1.0/stubs/AMQPConnectionException.php b/amqp-2.1.1/stubs/AMQPConnectionException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPConnectionException.php
rename to amqp-2.1.1/stubs/AMQPConnectionException.php
diff --git a/amqp-2.1.0/stubs/AMQPDecimal.php b/amqp-2.1.1/stubs/AMQPDecimal.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPDecimal.php
rename to amqp-2.1.1/stubs/AMQPDecimal.php
diff --git a/amqp-2.1.0/stubs/AMQPEnvelope.php b/amqp-2.1.1/stubs/AMQPEnvelope.php
similarity index 93%
rename from amqp-2.1.0/stubs/AMQPEnvelope.php
rename to amqp-2.1.1/stubs/AMQPEnvelope.php
index 76581c4..d72419a 100644
--- a/amqp-2.1.0/stubs/AMQPEnvelope.php
+++ b/amqp-2.1.1/stubs/AMQPEnvelope.php
@@ -1,104 +1,104 @@
<?php
/**
* stub class representing AMQPEnvelope from pecl-amqp
*/
class AMQPEnvelope extends AMQPBasicProperties
{
private string $body = '';
private ?string $consumerTag = null;
private ?int $deliveryTag = null;
private bool $isRedelivery = false;
private ?string $exchangeName = null;
private string $routingKey = '';
public function __construct()
{
}
/**
* Get the body of the message.
*
* @return string The contents of the message body.
*/
public function getBody(): string
{
}
/**
* Get the routing key of the message.
*
* @return string The message routing key.
*/
public function getRoutingKey(): string
{
}
/**
* Get the consumer tag of the message.
*
* @return string|null The consumer tag of the message.
*/
public function getConsumerTag(): ?string
{
}
/**
* Get the delivery tag of the message.
*
* @return integer|null The delivery tag of the message.
*/
public function getDeliveryTag(): ?int
{
}
/**
* Get the exchange name on which the message was published.
*
* @return string|null The exchange name on which the message was published.
*/
public function getExchangeName(): ?string
{
}
/**
* Whether this is a redelivery of the message.
*
* Whether this is a redelivery of a message. If this message has been
* delivered and AMQPEnvelope::nack() was called, the message will be put
* back on the queue to be redelivered, at which point the message will
* always return TRUE when this method is called.
*
* @return bool TRUE if this is a redelivery, FALSE otherwise.
*/
public function isRedelivery(): bool
{
}
/**
* Get a specific message header.
*
* @param string $headerName Name of the header to get the value from.
*
- * @return string|null The contents of the specified header or null if not set.
+ * @return mixed The contents of the specified header or null if not set.
*/
- public function getHeader(string $headerName): ?string
+ public function getHeader(string $headerName)
{
}
/**
* Check whether specific message header exists.
*
* @param string $headerName Name of the header to check.
*
* @return boolean
*/
public function hasHeader(string $headerName): bool
{
}
}
diff --git a/amqp-2.1.0/stubs/AMQPEnvelopeException.php b/amqp-2.1.1/stubs/AMQPEnvelopeException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPEnvelopeException.php
rename to amqp-2.1.1/stubs/AMQPEnvelopeException.php
diff --git a/amqp-2.1.0/stubs/AMQPException.php b/amqp-2.1.1/stubs/AMQPException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPException.php
rename to amqp-2.1.1/stubs/AMQPException.php
diff --git a/amqp-2.1.0/stubs/AMQPExchange.php b/amqp-2.1.1/stubs/AMQPExchange.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPExchange.php
rename to amqp-2.1.1/stubs/AMQPExchange.php
diff --git a/amqp-2.1.0/stubs/AMQPExchangeException.php b/amqp-2.1.1/stubs/AMQPExchangeException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPExchangeException.php
rename to amqp-2.1.1/stubs/AMQPExchangeException.php
diff --git a/amqp-2.1.0/stubs/AMQPQueue.php b/amqp-2.1.1/stubs/AMQPQueue.php
similarity index 98%
rename from amqp-2.1.0/stubs/AMQPQueue.php
rename to amqp-2.1.1/stubs/AMQPQueue.php
index bf9225c..18e95d2 100644
--- a/amqp-2.1.0/stubs/AMQPQueue.php
+++ b/amqp-2.1.1/stubs/AMQPQueue.php
@@ -1,406 +1,406 @@
<?php
/**
* stub class representing AMQPQueue from pecl-amqp
*/
class AMQPQueue
{
private AMQPConnection $connection;
private AMQPChannel $channel;
private ?string $name = null;
private ?string $consumerTag = null;
private bool $passive = false;
private bool $durable = false;
private bool $exclusive = false;
private bool $autoDelete = true;
private array $arguments = [];
/**
* Create an instance of an AMQPQueue object.
*
* @param AMQPChannel $channel The amqp channel to use.
*
* @throws AMQPQueueException When amqp_channel is not connected to a
* broker.
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function __construct(AMQPChannel $channel)
{
}
/**
* Acknowledge the receipt of a message.
*
* This method allows the acknowledgement of a message that is retrieved
* without the AMQP_AUTOACK flag through AMQPQueue::get() or
* AMQPQueue::consume()
*
* @param integer $deliveryTag The message delivery tag of which to
* acknowledge receipt.
* @param integer $flags The only valid flag that can be passed is
* AMQP_MULTIPLE.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function ack(int $deliveryTag, ?int $flags = null): void
{
}
/**
* Bind the given queue to a routing key on an exchange.
*
* @param string $exchangeName Name of the exchange to bind to.
* @param string $routingKey Pattern or routing key to bind with.
* @param array $arguments Additional binding arguments.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function bind(string $exchangeName, ?string $routingKey = null, array $arguments = []): void
{
}
/**
* Cancel a queue that is already bound to an exchange and routing key.
*
* @param string $consumerTag The consumer tag to cancel. If no tag is provided,
* or it is empty string, the latest consumer
* tag on this queue will be taken and after
* the successful cancellation request it will set to null.
* If the consumer_tag parameter is empty and the latest
* consumer tag is empty, no `basic.cancel` request will be
* sent.
* If either the consumer tag passed matches the latest tag
* or no consumer tag was passed and the latest tag was used
* the internal consumer tag will be set to null, so that
* `AMQPQueue::getConsumerTag()` will return null afterwards.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function cancel(string $consumerTag = ''): void
{
}
/**
* Consume messages from a queue.
*
* Blocking function that will retrieve the next message from the queue as
* it becomes available and will pass it off to the callback.
*
* @param callable|null $callback A callback function to which the
* consumed message will be passed. The
* function must accept at a minimum
* one parameter, an AMQPEnvelope object,
* and an optional second parameter
* the AMQPQueue object from which callback
* was invoked. The AMQPQueue::consume() will
* not return the processing thread back to
* the PHP script until the callback
* function returns FALSE.
* If the callback is omitted or null is passed,
* then the messages delivered to this client will
* be made available to the first real callback
* registered. That allows one to have a single
* callback consuming from multiple queues.
* @param integer $flags A bitmask of any of the flags: AMQP_AUTOACK,
* AMQP_JUST_CONSUME. Note: when AMQP_JUST_CONSUME
* flag used all other flags are ignored and
* $consumerTag parameter has no sense.
* AMQP_JUST_CONSUME flag prevent from sending
* `basic.consume` request and just run $callback
* if it provided. Calling method with empty $callback
* and AMQP_JUST_CONSUME makes no sense.
* @param string|null $consumerTag A string describing this consumer. Used
* for canceling subscriptions with cancel().
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPEnvelopeException When no queue found for envelope.
* @throws AMQPQueueException If timeout occurs or queue is not exists.
*/
public function consume(callable $callback = null, ?int $flags = null, ?string $consumerTag = null): void
{
}
/**
* Declare a new queue on the broker.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPQueueException On failure.
*
* @return integer the message count.
*/
public function declareQueue(): int
{
}
/**
* Declare a new queue on the broker.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPQueueException On failure.
*
* @return integer the message count.
*/
public function declare(): int
{
}
/**
* Delete a queue from the broker.
*
* This includes its entire contents of unread or unacknowledged messages.
*
* @param integer $flags Optionally AMQP_IFUNUSED can be specified
* to indicate the queue should not be
* deleted until no clients are connected to
* it.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return integer The number of deleted messages.
*/
public function delete(?int $flags = null): int
{
}
/**
* Retrieve the next message from the queue.
*
* Retrieve the next available message from the queue. If no messages are
- * present in the queue, this function will return FALSE immediately. This
+ * present in the queue, this function will return NULL immediately. This
* is a non blocking alternative to the AMQPQueue::consume() method.
* Currently, the only supported flag for the flags parameter is
* AMQP_AUTOACK. If this flag is passed in, then the message returned will
* automatically be marked as acknowledged by the broker as soon as the
* frames are sent to the client.
*
* @param integer $flags A bitmask of supported flags for the
* method call. Currently, the only the
* supported flag is AMQP_AUTOACK. If this
* value is not provided, it will use the
* value of ini-setting amqp.auto_ack.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPQueueException If queue is not exist.
*/
public function get(?int $flags = null): ?AMQPEnvelope
{
}
/**
* Get all the flags currently set on the given queue.
*
* @return int An integer bitmask of all the flags currently set on this
* exchange object.
*/
public function getFlags(): int
{
}
/**
* Get the configured name.
*
* @return string|null The configured name as a string.
*/
public function getName(): ?string
{
}
/**
* Mark a message as explicitly not acknowledged.
*
* Mark the message identified by delivery_tag as explicitly not
* acknowledged. This method can only be called on messages that have not
* yet been acknowledged, meaning that messages retrieved with by
* AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK
* flag are not eligible. When called, the broker will immediately put the
* message back onto the queue, instead of waiting until the connection is
* closed. This method is only supported by the RabbitMQ broker. The
* behavior of calling this method while connected to any other broker is
* undefined.
*
* @param integer $deliveryTag Delivery tag of last message to reject.
* @param integer $flags AMQP_REQUEUE to requeue the message(s),
* AMQP_MULTIPLE to nack all previous
* unacked messages as well.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function nack(int $deliveryTag, ?int $flags = null): void
{
}
/**
* Mark one message as explicitly not acknowledged.
*
* Mark the message identified by delivery_tag as explicitly not
* acknowledged. This method can only be called on messages that have not
* yet been acknowledged, meaning that messages retrieved with by
* AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK
* flag are not eligible.
*
* @param integer $deliveryTag Delivery tag of the message to reject.
* @param integer $flags AMQP_REQUEUE to requeue the message(s).
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function reject(int $deliveryTag, ?int $flags = null): void
{
}
/**
* Recover unacknowledged messages delivered to the current consumer.
*
* Recover all the unacknowledged messages delivered to the current consumer.
* If $requeue is true, the broker can redeliver the messages to different
- * consumers. If $requeue is false, it can only redeliver it to the current
+ * consumers. If $requeue is FALSE, it can only redeliver it to the current
* consumer. RabbitMQ does not implement $request = false.
* This method exposes `basic.recover` from the AMQP spec.
*
- * @param bool $requeue If true, deliver to any consumer, if false, deliver to the current consumer only
+ * @param bool $requeue If TRUE, deliver to any consumer, if FALSE, deliver to the current consumer only
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function recover(bool $requeue = true): void
{
}
/**
* Purge the contents of a queue.
*
* Returns the number of purged messages
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*/
public function purge(): int
{
}
/**
* Get the argument associated with the given key.
*
* @param string $argumentName The key to look up.
* @throws AMQPQueueException If key does not exist
* @return bool|int|double|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp
*/
public function getArgument(string $argumentName)
{
}
/**
* Set a queue argument.
*
* @param string $argumentName The argument name to set.
* @param bool|int|double|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp $argumentValue The argument value to set.
*/
public function setArgument(string $argumentName, $argumentValue): void
{
}
/**
* Set a queue argument.
*
* @param string $argumentName The argument name to set.
*/
public function removeArgument(string $argumentName): void
{
}
/**
* Set all arguments on the given queue.
*
* All other argument settings will be wiped.
*
* @param array $arguments An array of name/value pairs of arguments.
*/
public function setArguments(array $arguments): void
{
}
/**
* Get all set arguments as an array of key/value pairs.
*
* @return array An array containing all the set key/value pairs.
*/
public function getArguments(): array
{
}
/**
* Check whether a queue has specific argument.
*
* @param string $argumentName The argument name to check.
*
* @return boolean
*/
public function hasArgument(string $argumentName): bool
{
}
/**
* Set the flags on the queue.
*
* @param integer|null $flags A bitmask of flags:
* AMQP_DURABLE, AMQP_PASSIVE,
* AMQP_EXCLUSIVE, AMQP_AUTODELETE.
*/
public function setFlags(?int $flags): void
{
}
/**
* Set the queue name.
*
* @param string $name The name of the queue.
*/
public function setName(string $name): void
{
}
/**
* Remove a routing key binding on an exchange from the given queue.
*
* @param string $exchangeName The name of the exchange on which the queue is bound.
* @param string $routingKey The binding routing key used by the
* @param array $arguments Additional binding arguments.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @throws AMQPChannelException If the channel is not open.
*/
public function unbind(string $exchangeName, ?string $routingKey = null, array $arguments = []): void
{
}
/**
* Get the AMQPChannel object in use
*/
public function getChannel(): AMQPChannel
{
}
/**
* Get the AMQPConnection object in use
*/
public function getConnection(): AMQPConnection
{
}
/**
* Get latest consumer tag. If no consumer available or the latest on was canceled null will be returned.
*/
public function getConsumerTag(): ?string
{
}
}
diff --git a/amqp-2.1.0/stubs/AMQPQueueException.php b/amqp-2.1.1/stubs/AMQPQueueException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPQueueException.php
rename to amqp-2.1.1/stubs/AMQPQueueException.php
diff --git a/amqp-2.1.0/stubs/AMQPTimestamp.php b/amqp-2.1.1/stubs/AMQPTimestamp.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPTimestamp.php
rename to amqp-2.1.1/stubs/AMQPTimestamp.php
diff --git a/amqp-2.1.0/stubs/AMQPValue.php b/amqp-2.1.1/stubs/AMQPValue.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPValue.php
rename to amqp-2.1.1/stubs/AMQPValue.php
diff --git a/amqp-2.1.0/stubs/AMQPValueException.php b/amqp-2.1.1/stubs/AMQPValueException.php
similarity index 100%
rename from amqp-2.1.0/stubs/AMQPValueException.php
rename to amqp-2.1.1/stubs/AMQPValueException.php
diff --git a/amqp-2.1.0/tests/003-channel-consumers.phpt b/amqp-2.1.1/tests/003-channel-consumers.phpt
similarity index 93%
rename from amqp-2.1.0/tests/003-channel-consumers.phpt
rename to amqp-2.1.1/tests/003-channel-consumers.phpt
index faae621..98fdb8f 100644
--- a/amqp-2.1.0/tests/003-channel-consumers.phpt
+++ b/amqp-2.1.1/tests/003-channel-consumers.phpt
@@ -1,84 +1,84 @@
--TEST--
AMQPChannel - consumers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel1 = new AMQPChannel($cnn);
$q1 = new AMQPQueue($channel1);
$q1->setName('q1-' . bin2hex(random_bytes(32)));
$q1->declareQueue();
$channel2 = new AMQPChannel($cnn);
$q2_0 = new AMQPQueue($channel2);
$q2_0->setName('q2.0-' . bin2hex(random_bytes(32)));
$q2_0->declareQueue();
$q2_1 = new AMQPQueue($channel2);
$q2_1->setName('q2.1-' . bin2hex(random_bytes(32)));
$q2_1->declareQueue();
echo "Channels should have no consumers: c1: ", count($channel1->getConsumers()), ', c2: ', count($channel2->getConsumers()), PHP_EOL;
$q1->consume(null, AMQP_NOPARAM, 'test-consumer-0');
echo "Channel holds consumer: c1: ", count($channel1->getConsumers()), ', c2: ', count($channel2->getConsumers()), PHP_EOL;
$q2_0->consume(null, AMQP_NOPARAM, 'test-consumer-2-0');
$q2_1->consume(null, AMQP_NOPARAM, 'test-consumer-2-1');
echo "Channel holds consumer: c1: ", count($channel1->getConsumers()), ', c2: ', count($channel2->getConsumers()), PHP_EOL;
echo PHP_EOL;
echo "Consumers belongs to their channels:", PHP_EOL;
echo "c1:", PHP_EOL;
foreach ($channel1->getConsumers() as $tag => $queue) {
echo ' ', $tag, ': ', $queue->getName(), PHP_EOL;
}
echo "c2:", PHP_EOL;
foreach ($channel2->getConsumers() as $tag => $queue) {
echo ' ', $tag, ': ', $queue->getName(), PHP_EOL;
}
echo PHP_EOL;
$q1->cancel();
echo "Consumer removed after canceling: c1: ", count($channel1->getConsumers()), ', c2: ', count($channel2->getConsumers()), PHP_EOL;
$q2_0 = null;
$q2_1 = null;
echo "Consumer still stored after source variable been destroyed: c1: ", count($channel1->getConsumers()), ', c2: ', count($channel2->getConsumers()), PHP_EOL;
foreach ($channel2->getConsumers() as $tag => $queue) {
$queue->cancel();
}
echo "Consumer removed after canceling: c1: ", count($channel1->getConsumers()), ', c2: ', count($channel2->getConsumers()), PHP_EOL;
?>
--EXPECTF--
Channels should have no consumers: c1: 0, c2: 0
Channel holds consumer: c1: 1, c2: 0
Channel holds consumer: c1: 1, c2: 2
Consumers belongs to their channels:
c1:
test-consumer-0: q1-%s
c2:
test-consumer-2-0: q2.0-%s
test-consumer-2-1: q2.1-%s
Consumer removed after canceling: c1: 0, c2: 2
Consumer still stored after source variable been destroyed: c1: 0, c2: 2
Consumer removed after canceling: c1: 0, c2: 0
diff --git a/amqp-2.1.0/tests/004-queue-consume-nested.phpt b/amqp-2.1.1/tests/004-queue-consume-nested.phpt
similarity index 95%
rename from amqp-2.1.0/tests/004-queue-consume-nested.phpt
rename to amqp-2.1.1/tests/004-queue-consume-nested.phpt
index 9f735f0..c0f9315 100644
--- a/amqp-2.1.0/tests/004-queue-consume-nested.phpt
+++ b/amqp-2.1.1/tests/004-queue-consume-nested.phpt
@@ -1,110 +1,110 @@
--TEST--
AMQPQueue - nested consumers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
function test(AMQPChannel $channel1)
{
$ex1 = new AMQPExchange($channel1);
$ex1->setName('ex1-' . bin2hex(random_bytes(32)));
$ex1->setType(AMQP_EX_TYPE_FANOUT);
$ex1->declareExchange();
$q1 = new AMQPQueue($channel1);
$q1->setName('q1-' . bin2hex(random_bytes(32)));
$q1->declareQueue();
$q1->bind($ex1->getName());
$cnt1 = 4;
$cnt2 = 4;
$nested_publish = true;
for($i=0; $i < $cnt1; $i++) {
$ex1->publish("message 1 - {$i}");
}
$q1->consume(function (\AMQPEnvelope $message, \AMQPQueue $queue) use (&$cnt1, &$cnt2, &$nested_publish) {
$queue->ack($message->getDeliveryTag());
printf("1: %s [%s] %s - %s (%s): %s queue\n", $message->getExchangeName(), $message->getBody(), $message->getConsumerTag(), $queue->getConsumerTag(), $queue->getName(), $message->getConsumerTag() == $queue->getConsumerTag() ? 'valid' : 'not valid');
$channel2 = new \AMQPChannel($queue->getConnection());
$ex2 = new AMQPExchange($channel2);
$ex2->setName('ex2-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
$q2 = new AMQPQueue($channel2);
$q2->setName('q2-' . bin2hex(random_bytes(32)));
$q2->declareQueue();
$q2->bind($ex2->getName());
if ($nested_publish) {
for($i=0; $i < $cnt2; $i++) {
$ex2->publish("message 2 - {$i}");
}
$nested_publish = false;
}
$q2->consume(function (AMQPEnvelope $message, AMQPQueue $queue) use (&$cnt2) {
printf("2: %s [%s] %s - %s (%s): %s queue\n", $message->getExchangeName(), $message->getBody(), $message->getConsumerTag(), $queue->getConsumerTag(), $queue->getName(), $message->getConsumerTag() == $queue->getConsumerTag() ? 'valid' : 'not valid');
$queue->ack($message->getDeliveryTag());
return --$cnt2 > 1;
});
return --$cnt1 > 1;
});
}
$cnn1 = new AMQPConnection();
$cnn1->setHost(getenv('PHP_AMQP_HOST'));
$cnn1->connect();
$channel1 = new AMQPChannel($cnn1);
echo 'With default prefetch = 3', PHP_EOL;
test($channel1);
$channel1->close();
$channel1 = null;
$cnn1->disconnect();
$cnn1 = null;
// var_dump($channel1);
$cnn2 = new AMQPConnection();
$cnn2->setHost(getenv('PHP_AMQP_HOST'));
$cnn2->connect();
$channel2 = new AMQPChannel($cnn2);
$channel2->setPrefetchCount(1);
echo 'With prefetch = 1', PHP_EOL;
test($channel2);
?>
--EXPECTF--
With default prefetch = 3
1: ex1-%s [message 1 - 0] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
2: ex1-%s [message 1 - 1] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
2: ex1-%s [message 1 - 2] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
2: ex1-%s [message 1 - 3] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
1: ex2-%s [message 2 - 0] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
2: ex2-%s [message 2 - 1] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
1: ex2-%s [message 2 - 2] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
2: ex2-%s [message 2 - 3] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
With prefetch = 1
1: ex1-%s [message 1 - 0] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
2: ex1-%s [message 1 - 1] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
2: ex2-%s [message 2 - 0] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
2: ex2-%s [message 2 - 1] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
1: ex2-%s [message 2 - 2] amq.ctag-%s - amq.ctag-%s (q2-%s): valid queue
2: ex%d-%s [message %d - %d] amq.ctag-%s - amq.ctag-%s (q%d-%s): valid queue
1: ex%d-%s [message %d - %d] amq.ctag-%s - amq.ctag-%s (q%d-%s): valid queue
2: ex1-%s [message 1 - 3] amq.ctag-%s - amq.ctag-%s (q1-%s): valid queue
diff --git a/amqp-2.1.0/tests/004-queue-consume-orphaned.phpt b/amqp-2.1.1/tests/004-queue-consume-orphaned.phpt
similarity index 93%
rename from amqp-2.1.0/tests/004-queue-consume-orphaned.phpt
rename to amqp-2.1.1/tests/004-queue-consume-orphaned.phpt
index 46aad88..bd2c619 100644
--- a/amqp-2.1.0/tests/004-queue-consume-orphaned.phpt
+++ b/amqp-2.1.1/tests/004-queue-consume-orphaned.phpt
@@ -1,101 +1,101 @@
--TEST--
AMQPQueue - orphaned envelope
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel1 = new AMQPChannel($cnn);
$ex1 = new AMQPExchange($channel1);
$ex1->setName('ex1-' . bin2hex(random_bytes(32)));
$ex1->setType(AMQP_EX_TYPE_FANOUT);
$ex1->declareExchange();
$q1 = new AMQPQueue($channel1);
$q1->setName('q1-' . bin2hex(random_bytes(32)));
$q1->declareQueue();
$q1->bind($ex1->getName());
$ex1->publish("test passed");
$ex1->publish("test orphaned");
$q1->consume(function (AMQPEnvelope $message, AMQPQueue $queue) {
$queue->ack($message->getDeliveryTag());
return false;
});
$q1->cancel();
$q1 = null;
$q2 = new AMQPQueue($channel1);
$q2->setName('q1-' . bin2hex(random_bytes(32)));
$q2->declareQueue();
$q2->bind($ex1->getName());
try {
$q2->consume(function (AMQPEnvelope $message, AMQPQueue $queue) {
$queue->ack($message->getDeliveryTag());
return false;
});
} catch (AMQPEnvelopeException $e) {
echo get_class($e), ': ', $e->getMessage(), ':', PHP_EOL, PHP_EOL;
var_dump($e->getEnvelope());
}
?>
--EXPECTF--
AMQPEnvelopeException: Orphaned envelope:
object(AMQPEnvelope)#6 (20) {
["contentType":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
["body":"AMQPEnvelope":private]=>
string(13) "test orphaned"
["consumerTag":"AMQPEnvelope":private]=>
string(31) "amq.ctag-%s"
["deliveryTag":"AMQPEnvelope":private]=>
int(2)
["isRedelivery":"AMQPEnvelope":private]=>
bool(false)
["exchangeName":"AMQPEnvelope":private]=>
string(%d) "ex1-%s"
["routingKey":"AMQPEnvelope":private]=>
string(0) ""
}
diff --git a/amqp-2.1.0/tests/_test_helpers.php.inc b/amqp-2.1.1/tests/_test_helpers.php.inc
similarity index 100%
rename from amqp-2.1.0/tests/_test_helpers.php.inc
rename to amqp-2.1.1/tests/_test_helpers.php.inc
diff --git a/amqp-2.1.0/tests/amqp_version.phpt b/amqp-2.1.1/tests/amqp_version.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqp_version.phpt
rename to amqp-2.1.1/tests/amqp_version.phpt
index 9b65a65..7006109 100644
--- a/amqp-2.1.0/tests/amqp_version.phpt
+++ b/amqp-2.1.1/tests/amqp_version.phpt
@@ -1,24 +1,24 @@
--TEST--
AMQP extension version constants
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
var_dump(AMQP_EXTENSION_VERSION);
var_dump(AMQP_EXTENSION_VERSION_MAJOR);
var_dump(AMQP_EXTENSION_VERSION_MINOR);
var_dump(AMQP_EXTENSION_VERSION_PATCH);
var_dump(AMQP_EXTENSION_VERSION_EXTRA);
var_dump(AMQP_EXTENSION_VERSION_ID);
?>
==DONE==
--EXPECTF--
string(%d) "%d.%d.%s"
int(%d)
int(%d)
int(%d)
string(%d) "%S"
int(%d)
==DONE==
diff --git a/amqp-2.1.0/tests/amqpbasicproperties.phpt b/amqp-2.1.1/tests/amqpbasicproperties.phpt
similarity index 98%
rename from amqp-2.1.0/tests/amqpbasicproperties.phpt
rename to amqp-2.1.1/tests/amqpbasicproperties.phpt
index 62bb054..ac9bc38 100644
--- a/amqp-2.1.0/tests/amqpbasicproperties.phpt
+++ b/amqp-2.1.1/tests/amqpbasicproperties.phpt
@@ -1,165 +1,165 @@
--TEST--
AMQPBasicProperties
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
require '_test_helpers.php.inc';
$props = new AMQPBasicProperties();
var_dump($props);
dump_methods($props);
echo PHP_EOL;
$props = new AMQPBasicProperties(
"content_type",
"content_encoding",
array('test' => 'headers'),
42,
24,
"correlation_id",
"reply_to",
"expiration",
"message_id",
99999,
"type",
"user_id",
"app_id",
"cluster_id"
);
var_dump($props);
dump_methods($props);
?>
--EXPECT--
object(AMQPBasicProperties)#1 (14) {
["contentType":"AMQPBasicProperties":private]=>
string(0) ""
["contentEncoding":"AMQPBasicProperties":private]=>
string(0) ""
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
string(0) ""
["replyTo":"AMQPBasicProperties":private]=>
string(0) ""
["expiration":"AMQPBasicProperties":private]=>
string(0) ""
["messageId":"AMQPBasicProperties":private]=>
string(0) ""
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
string(0) ""
["userId":"AMQPBasicProperties":private]=>
string(0) ""
["appId":"AMQPBasicProperties":private]=>
string(0) ""
["clusterId":"AMQPBasicProperties":private]=>
string(0) ""
}
AMQPBasicProperties
getContentType():
string(0) ""
getContentEncoding():
string(0) ""
getHeaders():
array(0) {
}
getDeliveryMode():
int(1)
getPriority():
int(0)
getCorrelationId():
string(0) ""
getReplyTo():
string(0) ""
getExpiration():
string(0) ""
getMessageId():
string(0) ""
getTimestamp():
int(0)
getType():
string(0) ""
getUserId():
string(0) ""
getAppId():
string(0) ""
getClusterId():
string(0) ""
object(AMQPBasicProperties)#2 (14) {
["contentType":"AMQPBasicProperties":private]=>
string(12) "content_type"
["contentEncoding":"AMQPBasicProperties":private]=>
string(16) "content_encoding"
["headers":"AMQPBasicProperties":private]=>
array(1) {
["test"]=>
string(7) "headers"
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(42)
["priority":"AMQPBasicProperties":private]=>
int(24)
["correlationId":"AMQPBasicProperties":private]=>
string(14) "correlation_id"
["replyTo":"AMQPBasicProperties":private]=>
string(8) "reply_to"
["expiration":"AMQPBasicProperties":private]=>
string(10) "expiration"
["messageId":"AMQPBasicProperties":private]=>
string(10) "message_id"
["timestamp":"AMQPBasicProperties":private]=>
int(99999)
["type":"AMQPBasicProperties":private]=>
string(4) "type"
["userId":"AMQPBasicProperties":private]=>
string(7) "user_id"
["appId":"AMQPBasicProperties":private]=>
string(6) "app_id"
["clusterId":"AMQPBasicProperties":private]=>
string(10) "cluster_id"
}
AMQPBasicProperties
getContentType():
string(12) "content_type"
getContentEncoding():
string(16) "content_encoding"
getHeaders():
array(1) {
["test"]=>
string(7) "headers"
}
getDeliveryMode():
int(42)
getPriority():
int(24)
getCorrelationId():
string(14) "correlation_id"
getReplyTo():
string(8) "reply_to"
getExpiration():
string(10) "expiration"
getMessageId():
string(10) "message_id"
getTimestamp():
int(99999)
getType():
string(4) "type"
getUserId():
string(7) "user_id"
getAppId():
string(6) "app_id"
getClusterId():
string(10) "cluster_id"
diff --git a/amqp-2.1.0/tests/amqpchannel_basicRecover.phpt b/amqp-2.1.1/tests/amqpchannel_basicRecover.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpchannel_basicRecover.phpt
rename to amqp-2.1.1/tests/amqpchannel_basicRecover.phpt
index e9d1870..ac3193a 100644
--- a/amqp-2.1.0/tests/amqpchannel_basicRecover.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_basicRecover.phpt
@@ -1,112 +1,113 @@
--TEST--
AMQPChannel::basicRecover
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
$time = microtime(true);
$cnn_1 = new AMQPConnection();
$cnn_1->setHost(getenv('PHP_AMQP_HOST'));
$cnn_1->connect();
$channel_1 = new AMQPChannel($cnn_1);
$channel_1->setPrefetchCount(5);
$exchange_1 = new AMQPExchange($channel_1);
$exchange_1->setType(AMQP_EX_TYPE_TOPIC);
$exchange_1->setName('test_' . $time);
$exchange_1->setFlags(AMQP_AUTODELETE);
$exchange_1->declareExchange();
$queue_1 = new AMQPQueue($channel_1);
$queue_1->setName('test_' . $time);
$queue_1->setFlags(AMQP_DURABLE);
$queue_1->declareQueue();
$queue_1->bind($exchange_1->getName(), 'test');
$messages_count = 0;
while ($messages_count++ < 10) {
$exchange_1->publish('test message #' . $messages_count, 'test');
//echo 'published test message #' . $messages_count, PHP_EOL;
}
$consume = 2; // NOTE: by default prefetch-count=3, so in consumer below we will ignore prefetched messages 3-5,
// and they will not seen by other consumers until we redeliver it.
$queue_1->consume(function(AMQPEnvelope $e, AMQPQueue $q) use (&$consume) {
echo 'consumed ', $e->getBody(), ' ', ($e->isRedelivery() ? '(redelivered)' : '(original)'), PHP_EOL;
$q->ack($e->getDeliveryTag());
return (-- $consume > 0);
});
$queue_1->cancel(); // we have to do that to prevent redelivering to the same consumer
$cnn_2 = new AMQPConnection();
$cnn_2->setReadTimeout(1);
$cnn_2->setHost(getenv('PHP_AMQP_HOST'));
$cnn_2->connect();
$channel_2 = new AMQPChannel($cnn_2);
$channel_2->setPrefetchCount(8);
$queue_2 = new AMQPQueue($channel_2);
$queue_2->setName('test_' . $time);
$consume = 10;
try {
$queue_2->consume(function (AMQPEnvelope $e, AMQPQueue $q) use (&$consume) {
echo 'consumed ' . $e->getBody(), ' ', ($e->isRedelivery() ? '(redelivered)' : '(original)'), PHP_EOL;
$q->ack($e->getDeliveryTag());
return (--$consume > 0);
});
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
$queue_2->cancel();
//var_dump($cnn_2, $channel_2);die;
// yes, we do it repeatedly, basic.recover works in a slightly different way than it looks like. As it said,
// it "asks the server to redeliver all unacknowledged messages on a specified channel.
// ZERO OR MORE messages MAY BE redelivered"
$channel_1->basicRecover();
echo 'redelivered', PHP_EOL;
$consume = 10;
try {
$queue_2->consume(function (AMQPEnvelope $e, AMQPQueue $q) use (&$consume) {
echo 'consumed ' . $e->getBody(), ' ', ($e->isRedelivery() ? '(redelivered)' : '(original)'), PHP_EOL;
$q->ack($e->getDeliveryTag());
return (--$consume > 0);
});
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
consumed test message #1 (original)
consumed test message #2 (original)
consumed test message #8 (original)
consumed test message #9 (original)
consumed test message #10 (original)
AMQPQueueException(0): Consumer timeout exceed
redelivered
consumed test message #3 (redelivered)
consumed test message #4 (redelivered)
consumed test message #5 (redelivered)
consumed test message #6 (redelivered)
consumed test message #7 (redelivered)
AMQPQueueException(0): Consumer timeout exceed
diff --git a/amqp-2.1.0/tests/amqpchannel_close.phpt b/amqp-2.1.1/tests/amqpchannel_close.phpt
similarity index 89%
rename from amqp-2.1.0/tests/amqpchannel_close.phpt
rename to amqp-2.1.1/tests/amqpchannel_close.phpt
index ebcb8c9..d3d8a96 100644
--- a/amqp-2.1.0/tests/amqpchannel_close.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_close.phpt
@@ -1,60 +1,60 @@
--TEST--
AMQPChannel::close
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$time = microtime(true);
$cnn_1 = new AMQPConnection();
$cnn_1->setHost(getenv('PHP_AMQP_HOST'));
$cnn_1->connect();
$channel_1 = new AMQPChannel($cnn_1);
$channel_1->setPrefetchCount(5);
$exchange_1 = new AMQPExchange($channel_1);
$exchange_1->setType(AMQP_EX_TYPE_TOPIC);
$exchange_1->setName('test_' . $time);
$exchange_1->setFlags(AMQP_AUTODELETE);
$exchange_1->declareExchange();
$queue_1 = new AMQPQueue($channel_1);
$queue_1->setName('test_' . $time);
$queue_1->setFlags(AMQP_DURABLE);
$queue_1->declareQueue();
$queue_1->bind($exchange_1->getName(), 'test');
$messages_count = 0;
while ($messages_count++ < 3) {
$exchange_1->publish('test message #' . $messages_count, 'test');
}
$msg = $queue_1->get();
echo $msg->getBody(), PHP_EOL;
echo 'connected: ', var_export($channel_1->isConnected(), true), PHP_EOL;
$channel_1->close();
echo 'connected: ', var_export($channel_1->isConnected(), true), PHP_EOL;
try {
$queue_1->get();
} catch (AMQPChannelException $e) {
echo get_class($e), "({$e->getCode()}): " . $e->getMessage(), PHP_EOL;
}
$channel_1->close();
echo 'connected: ', var_export($channel_1->isConnected(), true), PHP_EOL;
?>
--EXPECT--
test message #1
connected: true
connected: false
AMQPChannelException(0): Could not get messages from queue. No channel available.
connected: false
diff --git a/amqp-2.1.0/tests/amqpchannel_confirmSelect.phpt b/amqp-2.1.1/tests/amqpchannel_confirmSelect.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpchannel_confirmSelect.phpt
rename to amqp-2.1.1/tests/amqpchannel_confirmSelect.phpt
index eec9a7d..d363ffb 100644
--- a/amqp-2.1.0/tests/amqpchannel_confirmSelect.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_confirmSelect.phpt
@@ -1,41 +1,41 @@
--TEST--
AMQPChannel::confirmSelect()
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$ch->confirmSelect();
echo 'confirm.select: OK', PHP_EOL;
try {
$ch->startTransaction();
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): " . $e->getMessage(), PHP_EOL;
}
$ch = new AMQPChannel($cnn);
$ch->startTransaction();
echo 'transaction.start: OK', PHP_EOL;
try {
$ch->confirmSelect();
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): " . $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
confirm.select: OK
AMQPChannelException(406): Server channel error: 406, message: PRECONDITION_FAILED - cannot switch from confirm to tx mode
transaction.start: OK
AMQPChannelException(406): Server channel error: 406, message: PRECONDITION_FAILED - cannot switch from tx to confirm mode
diff --git a/amqp-2.1.0/tests/amqpchannel_construct_basic.phpt b/amqp-2.1.1/tests/amqpchannel_construct_basic.phpt
similarity index 62%
rename from amqp-2.1.0/tests/amqpchannel_construct_basic.phpt
rename to amqp-2.1.1/tests/amqpchannel_construct_basic.phpt
index 369ef4f..dc1ae3b 100644
--- a/amqp-2.1.0/tests/amqpchannel_construct_basic.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_construct_basic.phpt
@@ -1,19 +1,19 @@
--TEST--
AMQPChannel constructor
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
echo get_class($ch) . "\n";
echo $ch->isConnected() ? 'true' : 'false';
?>
--EXPECT--
AMQPChannel
true
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpchannel_construct_ini_global_prefetch_count.phpt b/amqp-2.1.1/tests/amqpchannel_construct_ini_global_prefetch_count.phpt
similarity index 73%
rename from amqp-2.1.0/tests/amqpchannel_construct_ini_global_prefetch_count.phpt
rename to amqp-2.1.1/tests/amqpchannel_construct_ini_global_prefetch_count.phpt
index 3b21e0b..f187659 100644
--- a/amqp-2.1.0/tests/amqpchannel_construct_ini_global_prefetch_count.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_construct_ini_global_prefetch_count.phpt
@@ -1,26 +1,26 @@
--TEST--
AMQPChannel - constructor with amqp.global_prefetch_count ini value set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
?>
--INI--
amqp.global_prefetch_count=123
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(123)
int(0)
int(3)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_construct_ini_global_prefetch_size.phpt b/amqp-2.1.1/tests/amqpchannel_construct_ini_global_prefetch_size.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpchannel_construct_ini_global_prefetch_size.phpt
rename to amqp-2.1.1/tests/amqpchannel_construct_ini_global_prefetch_size.phpt
index 12a57f7..b84e3f9 100644
--- a/amqp-2.1.0/tests/amqpchannel_construct_ini_global_prefetch_size.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_construct_ini_global_prefetch_size.phpt
@@ -1,41 +1,41 @@
--TEST--
AMQPChannel - constructor with amqp.global_prefetch_size ini value set
--SKIPIF--
<?php
if (!extension_loaded("amqp")) {
- print "skip";
+ print "skip AMQP extension is not loaded";
} elseif (!getenv('PHP_AMQP_HOST')) {
- print "skip";
+ print "skip PHP_AMQP_HOST environment variable is not set";
} else {
try {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->setGlobalPrefetchSize(123);
} catch (AMQPConnectionException $e) {
if ($e->getCode() === 540 && strpos($e->getMessage(), "NOT_IMPLEMENTED") !== false) {
- print "skip";
+ print "skip prefetch size is not supported by the AMQP server";
}
}
}
?>
--INI--
amqp.global_prefetch_size=123
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(123)
int(3)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_construct_ini_prefetch_count.phpt b/amqp-2.1.1/tests/amqpchannel_construct_ini_prefetch_count.phpt
similarity index 72%
rename from amqp-2.1.0/tests/amqpchannel_construct_ini_prefetch_count.phpt
rename to amqp-2.1.1/tests/amqpchannel_construct_ini_prefetch_count.phpt
index 6f3a0d4..1919362 100644
--- a/amqp-2.1.0/tests/amqpchannel_construct_ini_prefetch_count.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_construct_ini_prefetch_count.phpt
@@ -1,26 +1,26 @@
--TEST--
AMQPChannel - constructor with amqp.prefetch_count ini value set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
?>
--INI--
amqp.prefetch_count=123
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(123)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_construct_ini_prefetch_size.phpt b/amqp-2.1.1/tests/amqpchannel_construct_ini_prefetch_size.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpchannel_construct_ini_prefetch_size.phpt
rename to amqp-2.1.1/tests/amqpchannel_construct_ini_prefetch_size.phpt
index 41be13e..6a1ad65 100644
--- a/amqp-2.1.0/tests/amqpchannel_construct_ini_prefetch_size.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_construct_ini_prefetch_size.phpt
@@ -1,41 +1,41 @@
--TEST--
AMQPChannel - constructor with amqp.prefetch_size ini value set
--SKIPIF--
<?php
if (!extension_loaded("amqp")) {
- print "skip";
+ print "skip AMQP extension is not loaded";
} elseif (!getenv('PHP_AMQP_HOST')) {
- print "skip";
+ print "skip PHP_AMQP_HOST environment variable is not set";
} else {
try {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->setPrefetchSize(123);
} catch (AMQPConnectionException $e) {
if ($e->getCode() === 540 && strpos($e->getMessage(), "NOT_IMPLEMENTED") !== false) {
- print "skip";
+ print "skip prefetch size is not supported by the AMQP server";
}
}
}
?>
--INI--
amqp.prefetch_size=123
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(123)
diff --git a/amqp-2.1.0/tests/amqpchannel_getChannelId.phpt b/amqp-2.1.1/tests/amqpchannel_getChannelId.phpt
similarity index 63%
rename from amqp-2.1.0/tests/amqpchannel_getChannelId.phpt
rename to amqp-2.1.1/tests/amqpchannel_getChannelId.phpt
index 26d2a08..00e7da8 100644
--- a/amqp-2.1.0/tests/amqpchannel_getChannelId.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_getChannelId.phpt
@@ -1,23 +1,23 @@
--TEST--
AMQPChannel::getChannelId
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ch->getChannelId());
$cnn->disconnect();
var_dump($ch->getChannelId());
?>
--EXPECT--
int(1)
int(1)
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpchannel_get_connection.phpt b/amqp-2.1.1/tests/amqpchannel_get_connection.phpt
similarity index 76%
rename from amqp-2.1.0/tests/amqpchannel_get_connection.phpt
rename to amqp-2.1.1/tests/amqpchannel_get_connection.phpt
index e24ff4c..8d3f2c0 100644
--- a/amqp-2.1.0/tests/amqpchannel_get_connection.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_get_connection.phpt
@@ -1,32 +1,32 @@
--TEST--
AMQPChannel getConnection test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$cnn2 = new AMQPConnection();
echo $cnn === $ch->getConnection() ? 'same' : 'not same', PHP_EOL;
echo $cnn2 === $ch->getConnection() ? 'same' : 'not same', PHP_EOL;
$old_host = $cnn->getHost();
$new_host = 'test';
$ch->getConnection()->setHost($new_host);
echo $cnn->getHost() == $new_host ? 'by ref' : 'copy', PHP_EOL;
?>
--EXPECT--
same
not same
by ref
diff --git a/amqp-2.1.0/tests/amqpchannel_multi_channel_connection.phpt b/amqp-2.1.1/tests/amqpchannel_multi_channel_connection.phpt
similarity index 74%
rename from amqp-2.1.0/tests/amqpchannel_multi_channel_connection.phpt
rename to amqp-2.1.1/tests/amqpchannel_multi_channel_connection.phpt
index 4f4d22d..735352b 100644
--- a/amqp-2.1.0/tests/amqpchannel_multi_channel_connection.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_multi_channel_connection.phpt
@@ -1,31 +1,31 @@
--TEST--
AMQPConnection - multiple AMQPChannels per AMQPConnection
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
echo get_class($ch) . "\n";
echo $ch->isConnected() ? 'true' : 'false';
echo "\n";
$ch2 = new AMQPChannel($cnn);
echo get_class($ch) . "\n";
echo $ch->isConnected() ? 'true' : 'false';
unset($ch2);
$ch->setPrefetchCount(10);
?>
--EXPECT--
AMQPChannel
true
AMQPChannel
true
diff --git a/amqp-2.1.0/tests/amqpchannel_set_global_prefetch_count.phpt b/amqp-2.1.1/tests/amqpchannel_set_global_prefetch_count.phpt
similarity index 78%
rename from amqp-2.1.0/tests/amqpchannel_set_global_prefetch_count.phpt
rename to amqp-2.1.1/tests/amqpchannel_set_global_prefetch_count.phpt
index 959552d..01d3fd7 100644
--- a/amqp-2.1.0/tests/amqpchannel_set_global_prefetch_count.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_set_global_prefetch_count.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPChannel::setGlobalPrefetchCount
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
$ch->setGlobalPrefetchCount(123);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
int(123)
int(0)
int(3)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_set_global_prefetch_size.phpt b/amqp-2.1.1/tests/amqpchannel_set_global_prefetch_size.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpchannel_set_global_prefetch_size.phpt
rename to amqp-2.1.1/tests/amqpchannel_set_global_prefetch_size.phpt
index 767e95e..f9dbd97 100644
--- a/amqp-2.1.0/tests/amqpchannel_set_global_prefetch_size.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_set_global_prefetch_size.phpt
@@ -1,51 +1,51 @@
--TEST--
AMQPChannel::setGlobalPrefetchSize
--SKIPIF--
<?php
if (!extension_loaded("amqp")) {
- print "skip";
+ print "skip AMQP extension is not loaded";
} elseif (!getenv('PHP_AMQP_HOST')) {
- print "skip";
+ print "skip PHP_AMQP_HOST environment variable is not set";
} else {
try {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->setGlobalPrefetchSize(123);
} catch (AMQPConnectionException $e) {
if ($e->getCode() === 540 && strpos($e->getMessage(), "NOT_IMPLEMENTED") !== false) {
- print "skip";
+ print "skip prefetch size is not supported by the AMQP server";
}
}
}
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
$ch->setGlobalPrefetchSize(123);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
int(0)
int(123)
int(3)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt b/amqp-2.1.1/tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt
similarity index 87%
rename from amqp-2.1.0/tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt
rename to amqp-2.1.1/tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt
index cd7e524..30e956a 100644
--- a/amqp-2.1.0/tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt
@@ -1,60 +1,60 @@
--TEST--
AMQPChannel - Setting both consumer and channel wide prefetch counts.
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
$ch->setPrefetchCount(11);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
// Shouldn't affect the prefetch count
$ch->setGlobalPrefetchCount(22);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
// Shouldn't affect the global prefetch count
$ch->setPrefetchCount(33);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
int(0)
int(0)
int(11)
int(0)
int(22)
int(0)
int(11)
int(0)
int(22)
int(0)
int(33)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt b/amqp-2.1.1/tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt
similarity index 89%
rename from amqp-2.1.0/tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt
rename to amqp-2.1.1/tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt
index 955daae..9dd8724 100644
--- a/amqp-2.1.0/tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt
@@ -1,76 +1,76 @@
--TEST--
AMQPChannel - Setting both consumer and channel wide prefetch sizes.
--SKIPIF--
<?php
if (!extension_loaded("amqp")) {
- print "skip";
+ print "skip AMQP extension is not loaded";
} elseif (!getenv('PHP_AMQP_HOST')) {
- print "skip";
+ print "skip PHP_AMQP_HOST environment variable is not set";
} else {
try {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->setPrefetchSize(123);
$ch->setGlobalPrefetchSize(123);
} catch (AMQPConnectionException $e) {
if ($e->getCode() === 540 && strpos($e->getMessage(), "NOT_IMPLEMENTED") !== false) {
- print "skip";
+ print "skip prefetch size is not supported by the AMQP server";
}
}
}
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
$ch->setPrefetchSize(11);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
// Shouldn't affect the prefetch count
$ch->setGlobalPrefetchSize(22);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
// Shouldn't affect the global prefetch count
$ch->setPrefetchSize(33);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
int(0)
int(0)
int(0)
int(11)
int(0)
int(22)
int(0)
int(11)
int(0)
int(22)
int(0)
int(33)
diff --git a/amqp-2.1.0/tests/amqpchannel_set_prefetch_count.phpt b/amqp-2.1.1/tests/amqpchannel_set_prefetch_count.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpchannel_set_prefetch_count.phpt
rename to amqp-2.1.1/tests/amqpchannel_set_prefetch_count.phpt
index 46716d9..2f4b3d1 100644
--- a/amqp-2.1.0/tests/amqpchannel_set_prefetch_count.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_set_prefetch_count.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPChannel::setPrefetchCount
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
$ch->setPrefetchCount(123);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
int(0)
int(0)
int(123)
int(0)
diff --git a/amqp-2.1.0/tests/amqpchannel_set_prefetch_size.phpt b/amqp-2.1.1/tests/amqpchannel_set_prefetch_size.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpchannel_set_prefetch_size.phpt
rename to amqp-2.1.1/tests/amqpchannel_set_prefetch_size.phpt
index 376f93d..42c410c 100644
--- a/amqp-2.1.0/tests/amqpchannel_set_prefetch_size.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_set_prefetch_size.phpt
@@ -1,51 +1,51 @@
--TEST--
AMQPChannel::setPrefetchSize
--SKIPIF--
<?php
if (!extension_loaded("amqp")) {
- print "skip";
+ print "skip AMQP extension is not loaded";
} elseif (!getenv('PHP_AMQP_HOST')) {
- print "skip";
+ print "skip PHP_AMQP_HOST environment variable is not set";
} else {
try {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->setPrefetchSize(123);
} catch (AMQPConnectionException $e) {
if ($e->getCode() === 540 && strpos($e->getMessage(), "NOT_IMPLEMENTED") !== false) {
- print "skip";
+ print "skip prefetch size is not supported by the AMQP server";
}
}
}
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
$ch->setPrefetchSize(123);
var_dump($ch->getGlobalPrefetchCount());
var_dump($ch->getGlobalPrefetchSize());
var_dump($ch->getPrefetchCount());
var_dump($ch->getPrefetchSize());
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
int(0)
int(0)
int(0)
int(123)
diff --git a/amqp-2.1.0/tests/amqpchannel_slots_usage.phpt b/amqp-2.1.1/tests/amqpchannel_slots_usage.phpt
similarity index 76%
rename from amqp-2.1.0/tests/amqpchannel_slots_usage.phpt
rename to amqp-2.1.1/tests/amqpchannel_slots_usage.phpt
index 5186f63..5b09ff1 100644
--- a/amqp-2.1.0/tests/amqpchannel_slots_usage.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_slots_usage.phpt
@@ -1,29 +1,29 @@
--TEST--
AMQPChannel slots usage
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
echo 'Used channels: ', $cnn->getUsedChannels(), PHP_EOL;
$ch = new AMQPChannel($cnn);
echo 'Used channels: ', $cnn->getUsedChannels(), PHP_EOL;
$ch = new AMQPChannel($cnn);
echo 'Used channels: ', $cnn->getUsedChannels(), PHP_EOL;
$ch = null;
echo 'Used channels: ', $cnn->getUsedChannels(), PHP_EOL;
?>
--EXPECT--
Used channels: 0
Used channels: 1
Used channels: 1
Used channels: 0
diff --git a/amqp-2.1.0/tests/amqpchannel_validation.phpt b/amqp-2.1.1/tests/amqpchannel_validation.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpchannel_validation.phpt
rename to amqp-2.1.1/tests/amqpchannel_validation.phpt
index 442fa6d..666371a 100644
--- a/amqp-2.1.0/tests/amqpchannel_validation.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_validation.phpt
@@ -1,68 +1,68 @@
--TEST--
AMQPChannel parameter validation
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$chan = new AMQPChannel($cnn);
try {
$chan->setPrefetchSize(-1);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setPrefetchSize(PHP_INT_MAX);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setGlobalPrefetchSize(-1);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setGlobalPrefetchSize(PHP_INT_MAX);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setPrefetchCount(-1);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setPrefetchCount(PHP_INT_MAX);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setGlobalPrefetchCount(-1);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
try {
$chan->setGlobalPrefetchCount(PHP_INT_MAX);
} catch (\Throwable $t) {
printf("%s: %s\n", get_class($t), $t->getMessage());
}
?>
==DONE==
--EXPECTF--
AMQPConnectionException: Parameter 'prefetchSize' must be between 0 and 4294967295.
AMQPConnectionException: Parameter 'prefetchSize' must be between 0 and 4294967295.
AMQPConnectionException: Parameter 'globalPrefetchSize' must be between 0 and 4294967295.
AMQPConnectionException: Parameter 'globalPrefetchSize' must be between 0 and 4294967295.
AMQPConnectionException: Parameter 'prefetchCount' must be between 0 and 65535.
AMQPConnectionException: Parameter 'prefetchCount' must be between 0 and 65535.
AMQPConnectionException: Parameter 'globalPrefetchCount' must be between 0 and 65535.
AMQPConnectionException: Parameter 'globalPrefetchCount' must be between 0 and 65535.
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpchannel_var_dump.phpt b/amqp-2.1.1/tests/amqpchannel_var_dump.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpchannel_var_dump.phpt
rename to amqp-2.1.1/tests/amqpchannel_var_dump.phpt
index 10239af..49c4d4e 100644
--- a/amqp-2.1.0/tests/amqpchannel_var_dump.phpt
+++ b/amqp-2.1.1/tests/amqpchannel_var_dump.phpt
@@ -1,124 +1,124 @@
--TEST--
AMQPChannel var_dump
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ch);
$cnn->disconnect();
var_dump($ch);
?>
--EXPECTF--
object(AMQPChannel)#2 (6) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
["prefetchCount":"AMQPChannel":private]=>
int(3)
["prefetchSize":"AMQPChannel":private]=>
int(0)
["globalPrefetchCount":"AMQPChannel":private]=>
int(0)
["globalPrefetchSize":"AMQPChannel":private]=>
int(0)
["consumers":"AMQPChannel":private]=>
array(0) {
}
}
object(AMQPChannel)#2 (6) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
["prefetchCount":"AMQPChannel":private]=>
int(3)
["prefetchSize":"AMQPChannel":private]=>
int(0)
["globalPrefetchCount":"AMQPChannel":private]=>
int(0)
["globalPrefetchSize":"AMQPChannel":private]=>
int(0)
["consumers":"AMQPChannel":private]=>
array(0) {
}
}
diff --git a/amqp-2.1.0/tests/amqpconnection_connect_login_failure.phpt b/amqp-2.1.1/tests/amqpconnection_connect_login_failure.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpconnection_connect_login_failure.phpt
rename to amqp-2.1.1/tests/amqpconnection_connect_login_failure.phpt
index 84122aa..3a9dba0 100644
--- a/amqp-2.1.0/tests/amqpconnection_connect_login_failure.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_connect_login_failure.phpt
@@ -1,35 +1,35 @@
--TEST--
AMQPConnection connect login failure
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
//ini_set('amqp.connect_timeout', 60);
//ini_set('amqp.read_timeout', 60);
//ini_set('amqp.write_timeout', 60);
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setLogin('nonexistent-login-'. bin2hex(random_bytes(32)));
$cnn->setPassword('nonexistent-password-'. bin2hex(random_bytes(32)));
//var_dump($cnn);
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
//
try {
$cnn->connect();
echo 'Connected', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
//
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
?>
--EXPECTF--
disconnected
AMQPConnectionException(403): %s
disconnected
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_connection_getters.phpt b/amqp-2.1.1/tests/amqpconnection_connection_getters.phpt
similarity index 93%
rename from amqp-2.1.0/tests/amqpconnection_connection_getters.phpt
rename to amqp-2.1.1/tests/amqpconnection_connection_getters.phpt
index 4c213fe..2fb3c3d 100644
--- a/amqp-2.1.0/tests/amqpconnection_connection_getters.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_connection_getters.phpt
@@ -1,90 +1,90 @@
--TEST--
AMQPConnection - connection-specific getters
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo PHP_EOL;
$cnn->connect();
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo PHP_EOL;
$cnn->disconnect();
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo PHP_EOL;
$cnn = new AMQPConnection(array('channel_max' => '10', 'frame_max' => 10240, 'heartbeat' => 10));
$cnn->setHost(getenv('PHP_AMQP_HOST'));
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo PHP_EOL;
$cnn->connect();
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo PHP_EOL;
$cnn->disconnect();
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo PHP_EOL;
?>
--EXPECT--
connected: false
channel_max: 256
frame_max: 131072
heartbeat: 0
connected: true
channel_max: 256
frame_max: 131072
heartbeat: 0
connected: false
channel_max: 256
frame_max: 131072
heartbeat: 0
connected: false
channel_max: 10
frame_max: 10240
heartbeat: 10
connected: true
channel_max: 10
frame_max: 10240
heartbeat: 10
connected: false
channel_max: 10
frame_max: 10240
heartbeat: 10
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_basic.phpt b/amqp-2.1.1/tests/amqpconnection_construct_basic.phpt
similarity index 66%
rename from amqp-2.1.0/tests/amqpconnection_construct_basic.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_basic.phpt
index d748221..3cc5dd3 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_basic.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_basic.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection constructor
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
echo get_class($cnn) . "\n";
echo $cnn->isConnected() ? 'true' : 'false', PHP_EOL;
echo $cnn->isPersistent() ? 'true' : 'false', PHP_EOL;
?>
--EXPECT--
AMQPConnection
true
false
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_ini_read_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_ini_read_timeout.phpt
similarity index 62%
rename from amqp-2.1.0/tests/amqpconnection_construct_ini_read_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_ini_read_timeout.phpt
index 7a91adf..8ff1159 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_ini_read_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_ini_read_timeout.phpt
@@ -1,17 +1,17 @@
--TEST--
AMQPConnection constructor with amqp.read_timeout ini value set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
?>
--INI--
amqp.read_timeout=202.202
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
float(202.202)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_ini_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_ini_timeout.phpt
similarity index 69%
rename from amqp-2.1.0/tests/amqpconnection_construct_ini_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_ini_timeout.phpt
index cb5b81a..197da23 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_ini_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_ini_timeout.phpt
@@ -1,18 +1,18 @@
--TEST--
AMQPConnection constructor with amqp.timeout ini value set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
?>
--INI--
amqp.timeout=101.101
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
%s: AMQPConnection::__construct(): INI setting 'amqp.timeout' is deprecated; use 'amqp.read_timeout' instead in %s on line 2
float(101.101)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
index 4904716..eef96ac 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
@@ -1,21 +1,21 @@
--TEST--
AMQPConnection constructor with both amqp.timeout and amqp.read_timeout ini values set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
?>
--INI--
amqp.timeout = 101.101
amqp.read_timeout = 202.202
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
%s: AMQPConnection::__construct(): INI setting 'amqp.timeout' is deprecated; use 'amqp.read_timeout' instead in %s on line 2
Notice: AMQPConnection::__construct(): INI setting 'amqp.read_timeout' will be used instead of 'amqp.timeout' in %s on line 2
float(202.202)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_ini_timeout_default.phpt b/amqp-2.1.1/tests/amqpconnection_construct_ini_timeout_default.phpt
similarity index 64%
rename from amqp-2.1.0/tests/amqpconnection_construct_ini_timeout_default.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_ini_timeout_default.phpt
index 761f82b..aef63ac 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_ini_timeout_default.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_ini_timeout_default.phpt
@@ -1,17 +1,17 @@
--TEST--
AMQPConnection constructor with amqp.timeout ini value set in code to it default value
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
ini_set('amqp.timeout', ini_get('amqp.timeout'));
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
float(0)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_params_by_value.phpt b/amqp-2.1.1/tests/amqpconnection_construct_params_by_value.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpconnection_construct_params_by_value.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_params_by_value.phpt
index 7217927..d03e203 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_params_by_value.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_params_by_value.phpt
@@ -1,45 +1,45 @@
--TEST--
Params are passed by value in AMQPConnection::__construct()
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$params = [
'host' => 'localhost',
'port' => 5432,
'login' => 'login',
'password' => 'password',
'read_timeout' => 10,
'write_timeout' => 10,
'connect_timeout' => 10,
'rpc_timeout' => 10,
'connection_name' => 'custom_connection_name'
];
$cnn = new AMQPConnection($params);
echo gettype($params['host']) . PHP_EOL;
echo gettype($params['port']) . PHP_EOL;
echo gettype($params['login']) . PHP_EOL;
echo gettype($params['password']) . PHP_EOL;
echo gettype($params['read_timeout']) . PHP_EOL;
echo gettype($params['write_timeout']) . PHP_EOL;
echo gettype($params['connect_timeout']) . PHP_EOL;
echo gettype($params['rpc_timeout']) . PHP_EOL;
echo gettype($params['connection_name']) . PHP_EOL;
--EXPECT--
string
integer
string
string
integer
integer
integer
integer
string
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_connect_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_connect_timeout.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_connect_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_connect_timeout.phpt
index a0745fa..8bf187e 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_connect_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_connect_timeout.phpt
@@ -1,45 +1,47 @@
--TEST--
AMQPConnection constructor with timeout parameter in credentials
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+elseif (getenv("SKIP_ONLINE_TESTS")) die('skip online test and SKIP_ONLINE_TESTS is set');
+elseif (getenv("SKIP_SLOW_TESTS")) die('skip slow test and SKIP_SLOW_TESTS is set');
?>
--FILE--
<?php
try {
$cnn = new AMQPConnection(array('connect_timeout' => -1.5));
} catch (AMQPConnectionException $e) {
echo $e->getMessage(), PHP_EOL;
}
$timeout = 10.5;
// resolve hostname to don't waste time on resolve inside library while resolve operations are not under timings limit (yet)
$credentials = array('host' => gethostbyname('google.com'), 'connect_timeout' => $timeout);
//$credentials = array('host' => 'google.com', 'connect_timeout' => $timeout);
$cnn = new AMQPConnection($credentials);
$start = microtime(true);
try {
$cnn->connect();
} catch (AMQPConnectionException $e) {
echo $e->getMessage(), PHP_EOL;
$end = microtime(true);
$error = $end - $start - $timeout;
$limit = abs(log10($timeout)); // empirical value
echo 'error: ', $error, PHP_EOL;
echo 'limit: ', $limit, PHP_EOL;
echo abs($error) <= $limit ? 'timings OK' : 'timings failed'; // error should be less than 5% of timeout value
}
?>
--EXPECTF--
Parameter 'connect_timeout' must be greater than or equal to zero.
Socket error: could not connect to host, request timed out
error: %f
limit: %f
timings OK
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_connection_name.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_connection_name.phpt
similarity index 87%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_connection_name.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_connection_name.phpt
index 17a5b49..1d8f1b3 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_connection_name.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_connection_name.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection constructor with connection_name parameter in credentials
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
// Test connection name as a string
$credentials = array('connection_name' => "custom connection name");
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getConnectionName());
// Test explicitly setting connection name as null
$credentials = array('connection_name' => null);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getConnectionName());
?>
--EXPECT--
string(22) "custom connection name"
NULL
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_limits.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_limits.phpt
similarity index 88%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_limits.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_limits.phpt
index 40c2c65..fff40b4 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_limits.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_limits.phpt
@@ -1,59 +1,59 @@
--TEST--
AMQPConnection constructor with channel_max, frame_max and heartbeat limits
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$credentials = array(
'channel_max' => 10,
'frame_max' => 10240,
'heartbeat' => 5,
);
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
var_dump($cnn);
?>
--EXPECTF--
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(10240)
["channelMax":"AMQPConnection":private]=>
int(10)
["heartbeat":"AMQPConnection":private]=>
int(5)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_rpc_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_rpc_timeout.phpt
similarity index 78%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_rpc_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_rpc_timeout.phpt
index ef29e52..6568190 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_rpc_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_rpc_timeout.phpt
@@ -1,14 +1,14 @@
--TEST--
AMQPConnection constructor with rpc_timeout parameter in credentials
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$credentials = array('rpc_timeout' => 303.303);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getRpcTimeout());
?>
--EXPECT--
float(303.303)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_timeout.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_timeout.phpt
index d18c0ad..b402cdd 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_timeout.phpt
@@ -1,15 +1,15 @@
--TEST--
AMQPConnection constructor with timeout parameter in credentials
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$credentials = array('timeout' => 101.101);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
%s: AMQPConnection::__construct(): Parameter 'timeout' is deprecated; use 'read_timeout' instead in %s on line 3
float(101.101)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
similarity index 85%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
index 9dd1f48..6eaf11d 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
@@ -1,15 +1,15 @@
--TEST--
AMQPConnection constructor with both timeout and read_timeout parameters in credentials
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$credentials = array('timeout' => 101.101, 'read_timeout' => 202.202);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
Notice: AMQPConnection::__construct(): Parameter 'timeout' is deprecated, 'read_timeout' used instead in %s on line 3
float(202.202)
diff --git a/amqp-2.1.1/tests/amqpconnection_construct_with_verify_false.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_verify_false.phpt
new file mode 100644
index 0000000..cb6162f
--- /dev/null
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_verify_false.phpt
@@ -0,0 +1,14 @@
+--TEST--
+AMQPConnection constructor with verify parameter set to false in $params
+--SKIPIF--
+<?php
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+?>
+--FILE--
+<?php
+$params = array('verify' => false);
+$cnn = new AMQPConnection($params);
+var_dump($cnn->getVerify());
+?>
+--EXPECT--
+bool(false)
diff --git a/amqp-2.1.0/tests/amqpconnection_construct_with_write_timeout.phpt b/amqp-2.1.1/tests/amqpconnection_construct_with_write_timeout.phpt
similarity index 78%
rename from amqp-2.1.0/tests/amqpconnection_construct_with_write_timeout.phpt
rename to amqp-2.1.1/tests/amqpconnection_construct_with_write_timeout.phpt
index a455cff..a2a8b58 100644
--- a/amqp-2.1.0/tests/amqpconnection_construct_with_write_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_construct_with_write_timeout.phpt
@@ -1,14 +1,14 @@
--TEST--
AMQPConnection constructor with write_timeout parameter in $cnntials
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$credentials = array('write_timeout' => 303.303);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getWriteTimeout());
?>
--EXPECT--
float(303.303)
diff --git a/amqp-2.1.0/tests/amqpconnection_getUsedChannels.phpt b/amqp-2.1.1/tests/amqpconnection_getUsedChannels.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpconnection_getUsedChannels.phpt
rename to amqp-2.1.1/tests/amqpconnection_getUsedChannels.phpt
index f3a58f6..d8655f1 100644
--- a/amqp-2.1.0/tests/amqpconnection_getUsedChannels.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_getUsedChannels.phpt
@@ -1,29 +1,29 @@
--TEST--
AMQPConnection::getUsedChannels()
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
echo get_class($cnn), '::getUsedChannels():', $cnn->getUsedChannels(), PHP_EOL;
$cnn->connect();
echo get_class($cnn), '::getUsedChannels():', $cnn->getUsedChannels(), PHP_EOL;
$ch = new AMQPChannel($cnn);
echo get_class($cnn), '::getUsedChannels():', $cnn->getUsedChannels(), PHP_EOL;
$ch = null;
echo get_class($cnn), '::getUsedChannels():', $cnn->getUsedChannels(), PHP_EOL;
?>
--EXPECTF--
AMQPConnection::getUsedChannels():
Warning: AMQPConnection::getUsedChannels(): Connection is not connected. in %s on line %d
0
AMQPConnection::getUsedChannels():0
AMQPConnection::getUsedChannels():1
AMQPConnection::getUsedChannels():0
diff --git a/amqp-2.1.0/tests/amqpconnection_heartbeat.phpt b/amqp-2.1.1/tests/amqpconnection_heartbeat.phpt
similarity index 80%
rename from amqp-2.1.0/tests/amqpconnection_heartbeat.phpt
rename to amqp-2.1.1/tests/amqpconnection_heartbeat.phpt
index 1381646..6dce995 100644
--- a/amqp-2.1.0/tests/amqpconnection_heartbeat.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_heartbeat.phpt
@@ -1,40 +1,41 @@
--TEST--
AMQPConnection - heartbeats support
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
$heartbeat = 2;
$credentials = array('heartbeat' => $heartbeat);
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
sleep($heartbeat*5);
try {
$ch = new AMQPChannel($cnn);
echo 'channel created', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
?>
--EXPECTREGEX--
heartbeat: 2
connected: true
persistent: false
AMQPConnectionException\(0\): (a socket error occurred|connection closed unexpectedly)
heartbeat: 2
connected: false
persistent: false
diff --git a/amqp-2.1.0/tests/amqpconnection_heartbeat_with_consumer.phpt b/amqp-2.1.1/tests/amqpconnection_heartbeat_with_consumer.phpt
similarity index 91%
rename from amqp-2.1.0/tests/amqpconnection_heartbeat_with_consumer.phpt
rename to amqp-2.1.1/tests/amqpconnection_heartbeat_with_consumer.phpt
index 59b1909..314edbf 100644
--- a/amqp-2.1.0/tests/amqpconnection_heartbeat_with_consumer.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_heartbeat_with_consumer.phpt
@@ -1,108 +1,109 @@
--TEST--
AMQPConnection heartbeats support (with active consumer)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
$heartbeat = 2;
$credentials = array('heartbeat' => $heartbeat, 'read_timeout' => $heartbeat * 20);
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
var_dump($cnn);
$ch = new AMQPChannel($cnn);
$q_dead_name = 'test.queue.dead.' . bin2hex(random_bytes(32));
$q_name = 'test.queue.' . bin2hex(random_bytes(32));
$e = new AMQPExchange($ch);
$q = new AMQPQueue($ch);
$q->setName($q_name);
$q->declareQueue();
$q_dead = new AMQPQueue($ch);
$q_dead->setName($q_dead_name);
$q_dead->setArgument('x-dead-letter-exchange', '');
$q_dead->setArgument('x-dead-letter-routing-key', $q_name);
$q_dead->setArgument('x-message-ttl', $heartbeat * 10 * 1000);
$q_dead->declareQueue();
$e->publish('test message 1 (should be dead lettered)', $q_dead_name);
$t = microtime(true);
$q->consume(function (AMQPEnvelope $envelope) {
echo 'Consumed: ', $envelope->getBody(), PHP_EOL;
return false;
});
$t = microtime(true) - $t;
echo 'Consuming took: ', (float) round($t, 4), 'sec', PHP_EOL;
$t_min = (float)round($heartbeat * 9.5, 4);
$t_max = (float)round($heartbeat * 10.5, 4);
if ($t > $t_min && $t < $t_max) {
echo "Timing OK ($t_min < $t < $t_max)", PHP_EOL;
} else {
echo "Timing ERROR ($t_min < $t < $t_max)", PHP_EOL;
}
$ch2 = new AMQPChannel($cnn);
sleep($heartbeat/2);
$ch3 = new AMQPChannel($cnn);
echo 'Done', PHP_EOL
?>
--EXPECTF--
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(40)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(2)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
Consumed: test message 1 (should be dead lettered)
Consuming took: %fsec
Timing OK (%f < %f < %f)
Done
diff --git a/amqp-2.1.0/tests/amqpconnection_heartbeat_with_persistent.phpt b/amqp-2.1.1/tests/amqpconnection_heartbeat_with_persistent.phpt
similarity index 90%
rename from amqp-2.1.0/tests/amqpconnection_heartbeat_with_persistent.phpt
rename to amqp-2.1.1/tests/amqpconnection_heartbeat_with_persistent.phpt
index 502f1d9..de20824 100644
--- a/amqp-2.1.0/tests/amqpconnection_heartbeat_with_persistent.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_heartbeat_with_persistent.phpt
@@ -1,96 +1,97 @@
--TEST--
AMQPConnection - heartbeats support with persistent connections
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
$heartbeat = 2;
$credentials = array('heartbeat' => $heartbeat);
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
echo PHP_EOL;
$cnn->pconnect();
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
echo PHP_EOL;
sleep($heartbeat*5);
try {
$ch = new AMQPChannel($cnn);
echo 'channel created', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
echo PHP_EOL;
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->pconnect();
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
echo PHP_EOL;
$ch = new AMQPChannel($cnn);
echo 'channel created', PHP_EOL;
echo PHP_EOL;
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
echo PHP_EOL;
$cnn->pdisconnect();
echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
echo PHP_EOL;
?>
--EXPECTREGEX--
heartbeat: 2
connected: false
persistent: false
heartbeat: 2
connected: true
persistent: true
AMQPConnectionException\(0\): (a socket error occurred|connection closed unexpectedly)
heartbeat: 2
connected: false
persistent: false
heartbeat: 2
connected: true
persistent: true
channel created
heartbeat: 2
connected: true
persistent: true
heartbeat: 2
connected: false
persistent: false
diff --git a/amqp-2.1.0/tests/amqpconnection_nullable_setters.phpt b/amqp-2.1.1/tests/amqpconnection_nullable_setters.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpconnection_nullable_setters.phpt
rename to amqp-2.1.1/tests/amqpconnection_nullable_setters.phpt
index fb57489..af36e48 100644
--- a/amqp-2.1.0/tests/amqpconnection_nullable_setters.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_nullable_setters.phpt
@@ -1,53 +1,53 @@
--TEST--
AMQPConnection - setters and nullability
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$c = new AMQPConnection();
$c->setKey('key');
var_dump($c->getKey());
$c->setKey(null);
var_dump($c->getKey());
$c->setKey('');
var_dump($c->getKey());
$c->setCert('cert');
var_dump($c->getCert());
$c->setCert(null);
var_dump($c->getCert());
$c->setCert('');
var_dump($c->getCert());
$c->setCACert('cacert');
var_dump($c->getCACert());
$c->setCACert(null);
var_dump($c->getCACert());
$c->setCACert('');
var_dump($c->getCACert());
$c->setConnectionName('con');
var_dump($c->getConnectionName());
$c->setConnectionName(null);
var_dump($c->getConnectionName());
$c->setConnectionName('');
var_dump($c->getConnectionName());
?>
==DONE==
--EXPECT--
string(3) "key"
NULL
string(0) ""
string(4) "cert"
NULL
string(0) ""
string(6) "cacert"
NULL
string(0) ""
string(3) "con"
NULL
string(0) ""
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_persistent_construct_basic.phpt b/amqp-2.1.1/tests/amqpconnection_persistent_construct_basic.phpt
similarity index 67%
rename from amqp-2.1.0/tests/amqpconnection_persistent_construct_basic.phpt
rename to amqp-2.1.1/tests/amqpconnection_persistent_construct_basic.phpt
index 7ecae0f..12b5afb 100644
--- a/amqp-2.1.0/tests/amqpconnection_persistent_construct_basic.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_persistent_construct_basic.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection persitent constructor
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->pconnect();
echo get_class($cnn) . "\n";
echo $cnn->isConnected() ? 'true' : 'false', PHP_EOL;
echo $cnn->isPersistent() ? 'true' : 'false', PHP_EOL;
?>
--EXPECT--
AMQPConnection
true
true
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_persistent_in_use.phpt b/amqp-2.1.1/tests/amqpconnection_persistent_in_use.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpconnection_persistent_in_use.phpt
rename to amqp-2.1.1/tests/amqpconnection_persistent_in_use.phpt
index 60aaf14..f6e385a 100644
--- a/amqp-2.1.0/tests/amqpconnection_persistent_in_use.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_persistent_in_use.phpt
@@ -1,37 +1,37 @@
--TEST--
AMQPConnection persitent connection resource can't be used by multiple connection
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
echo get_class($cnn), PHP_EOL;
$cnn->pconnect();
echo $cnn->isConnected() ? 'true' : 'false', PHP_EOL;
echo PHP_EOL;
$cnn2 = new AMQPConnection();
$cnn2->setHost(getenv('PHP_AMQP_HOST'));
echo get_class($cnn), PHP_EOL;
try {
$cnn2->pconnect();
echo 'reused', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo $cnn->isConnected() ? 'true' : 'false', PHP_EOL;
?>
--EXPECT--
AMQPConnection
true
AMQPConnection
AMQPConnectionException(0): There are already established persistent connection to the same resource.
true
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_persistent_reusable.phpt b/amqp-2.1.1/tests/amqpconnection_persistent_reusable.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpconnection_persistent_reusable.phpt
rename to amqp-2.1.1/tests/amqpconnection_persistent_reusable.phpt
index 2a0d4ef..e8b7fa0 100644
--- a/amqp-2.1.0/tests/amqpconnection_persistent_reusable.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_persistent_reusable.phpt
@@ -1,51 +1,51 @@
--TEST--
AMQPConnection persistent connection are reusable
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$manual = false; // set to true when you want to check via RabbitMQ Management panel that connection really persists.
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->pconnect();
echo get_class($cnn), PHP_EOL;
echo $cnn->isConnected() ? 'true' : 'false', PHP_EOL;
if ($manual) {
$ch = new AMQPChannel($cnn);
sleep(10);
$ch = null;
}
$cnn = null;
echo PHP_EOL;
if ($manual) {
sleep(10);
}
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->pconnect();
echo get_class($cnn), PHP_EOL;
echo $cnn->isConnected() ? 'true' : 'false', PHP_EOL;
if ($manual) {
$ch = new AMQPChannel($cnn);
sleep(10);
$ch = null;
}
$cnn->pdisconnect();
?>
--EXPECT--
AMQPConnection
true
AMQPConnection
true
diff --git a/amqp-2.1.0/tests/amqpconnection_setConnectionName.phpt b/amqp-2.1.1/tests/amqpconnection_setConnectionName.phpt
similarity index 70%
rename from amqp-2.1.0/tests/amqpconnection_setConnectionName.phpt
rename to amqp-2.1.1/tests/amqpconnection_setConnectionName.phpt
index 26cd90f..5128b07 100644
--- a/amqp-2.1.0/tests/amqpconnection_setConnectionName.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setConnectionName.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection setConnectionName
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
var_dump($cnn->getConnectionName());
$cnn->setConnectionName('custom connection name');
var_dump($cnn->getConnectionName());
$cnn->setConnectionName(null);
var_dump($cnn->getConnectionName());
--EXPECTF--
NULL
string(22) "custom connection name"
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_setHost.phpt b/amqp-2.1.1/tests/amqpconnection_setHost.phpt
similarity index 76%
rename from amqp-2.1.0/tests/amqpconnection_setHost.phpt
rename to amqp-2.1.1/tests/amqpconnection_setHost.phpt
index 8de4b74..57656bc 100644
--- a/amqp-2.1.0/tests/amqpconnection_setHost.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setHost.phpt
@@ -1,15 +1,15 @@
--TEST--
AMQPConnection setHost
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
var_dump($cnn->getHost());
$cnn->setHost('nonexistent');
var_dump($cnn->getHost());
--EXPECTF--
string(9) "localhost"
string(11) "nonexistent"
diff --git a/amqp-2.1.0/tests/amqpconnection_setLogin.phpt b/amqp-2.1.1/tests/amqpconnection_setLogin.phpt
similarity index 62%
rename from amqp-2.1.0/tests/amqpconnection_setLogin.phpt
rename to amqp-2.1.1/tests/amqpconnection_setLogin.phpt
index 14e742c..1a927af 100644
--- a/amqp-2.1.0/tests/amqpconnection_setLogin.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setLogin.phpt
@@ -1,17 +1,17 @@
--TEST--
AMQPConnection setLogin
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
var_dump($cnn->getLogin());
$cnn->setLogin('nonexistent');
var_dump($cnn->getLogin());
--EXPECTF--
string(5) "guest"
string(11) "nonexistent"
diff --git a/amqp-2.1.0/tests/amqpconnection_setPassword.phpt b/amqp-2.1.1/tests/amqpconnection_setPassword.phpt
similarity index 63%
rename from amqp-2.1.0/tests/amqpconnection_setPassword.phpt
rename to amqp-2.1.1/tests/amqpconnection_setPassword.phpt
index 53371f3..a2165f8 100644
--- a/amqp-2.1.0/tests/amqpconnection_setPassword.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setPassword.phpt
@@ -1,17 +1,17 @@
--TEST--
AMQPConnection setPassword
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
var_dump($cnn->getPassword());
$cnn->setPassword('nonexistent');
var_dump($cnn->getPassword());
--EXPECTF--
string(5) "guest"
string(11) "nonexistent"
diff --git a/amqp-2.1.0/tests/amqpconnection_setPort_int.phpt b/amqp-2.1.1/tests/amqpconnection_setPort_int.phpt
similarity index 62%
rename from amqp-2.1.0/tests/amqpconnection_setPort_int.phpt
rename to amqp-2.1.1/tests/amqpconnection_setPort_int.phpt
index 29d8e34..48acebd 100644
--- a/amqp-2.1.0/tests/amqpconnection_setPort_int.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setPort_int.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection constructor
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
$port = 12345;
var_dump($cnn->setPort($port));
echo $cnn->getPort(), PHP_EOL;
echo gettype($port), PHP_EOL;
?>
--EXPECT--
NULL
12345
integer
diff --git a/amqp-2.1.0/tests/amqpconnection_setPort_out_of_range.phpt b/amqp-2.1.1/tests/amqpconnection_setPort_out_of_range.phpt
similarity index 66%
rename from amqp-2.1.0/tests/amqpconnection_setPort_out_of_range.phpt
rename to amqp-2.1.1/tests/amqpconnection_setPort_out_of_range.phpt
index db21f23..b20df06 100644
--- a/amqp-2.1.0/tests/amqpconnection_setPort_out_of_range.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setPort_out_of_range.phpt
@@ -1,19 +1,19 @@
--TEST--
AMQPConnection setPort with int out of range
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
try {
$cnn->setPort(1234567890);
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Parameter 'port' must be a valid port number between 1 and 65535.
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_setPort_string.phpt b/amqp-2.1.1/tests/amqpconnection_setPort_string.phpt
similarity index 63%
rename from amqp-2.1.0/tests/amqpconnection_setPort_string.phpt
rename to amqp-2.1.1/tests/amqpconnection_setPort_string.phpt
index 61861a5..561fd5f 100644
--- a/amqp-2.1.0/tests/amqpconnection_setPort_string.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setPort_string.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection setPort with string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
$port = '12345';
var_dump($cnn->setPort($port));
var_dump($cnn->getPort());
var_dump($port);
?>
--EXPECT--
NULL
int(12345)
string(5) "12345"
diff --git a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_float.phpt b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_float.phpt
similarity index 65%
rename from amqp-2.1.0/tests/amqpconnection_setReadTimeout_float.phpt
rename to amqp-2.1.1/tests/amqpconnection_setReadTimeout_float.phpt
index 10b818a..25dcb75 100644
--- a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_float.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_float.phpt
@@ -1,18 +1,18 @@
--TEST--
AMQPConnection setReadTimeout float
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setReadTimeout(.34);
var_dump($cnn->getReadTimeout());
$cnn->setReadTimeout(4.7e-2);
var_dump($cnn->getReadTimeout());?>
--EXPECT--
float(0.34)
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_int.phpt b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_int.phpt
similarity index 57%
rename from amqp-2.1.0/tests/amqpconnection_setReadTimeout_int.phpt
rename to amqp-2.1.1/tests/amqpconnection_setReadTimeout_int.phpt
index 9ebcac2..07ca3cd 100644
--- a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_int.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_int.phpt
@@ -1,16 +1,16 @@
--TEST--
AMQPConnection setReadTimeout int
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setReadTimeout(3);
var_dump($cnn->getReadTimeout());
?>
--EXPECT--
float(3)
diff --git a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_out_of_range.phpt b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_out_of_range.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpconnection_setReadTimeout_out_of_range.phpt
rename to amqp-2.1.1/tests/amqpconnection_setReadTimeout_out_of_range.phpt
index e01ee66..6f410ae 100644
--- a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_out_of_range.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_out_of_range.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPConnection setReadTimeout out of range
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
try {
$cnn->setReadTimeout(-1);
} catch (Exception $e) {
echo get_class($e);
echo PHP_EOL;
echo $e->getMessage();
}
?>
--EXPECT--
AMQPConnectionException
Parameter 'readTimeout' must be greater than or equal to zero.
diff --git a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_string.phpt b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_string.phpt
similarity index 65%
rename from amqp-2.1.0/tests/amqpconnection_setReadTimeout_string.phpt
rename to amqp-2.1.1/tests/amqpconnection_setReadTimeout_string.phpt
index c36fbc7..ecbad92 100644
--- a/amqp-2.1.0/tests/amqpconnection_setReadTimeout_string.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setReadTimeout_string.phpt
@@ -1,18 +1,18 @@
--TEST--
AMQPConnection setReadTimeout string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setReadTimeout(".34");
var_dump($cnn->getReadTimeout());
$cnn->setReadTimeout("4.7e-2");
var_dump($cnn->getReadTimeout());?>
--EXPECT--
float(0.34)
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_float.phpt b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_float.phpt
similarity index 71%
rename from amqp-2.1.0/tests/amqpconnection_setRpcTimeout_float.phpt
rename to amqp-2.1.1/tests/amqpconnection_setRpcTimeout_float.phpt
index 02005a9..1fd3dd6 100644
--- a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_float.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_float.phpt
@@ -1,25 +1,25 @@
--TEST--
AMQPConnection setRpcTimeout float
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$timeout = .34;
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setRpcTimeout($timeout);
var_dump($cnn->getRpcTimeout());
var_dump($timeout);
$timeout = 4.7e-2;
$cnn->setRpcTimeout($timeout);
var_dump($cnn->getRpcTimeout());
var_dump($timeout);
?>
--EXPECT--
float(0.34)
float(0.34)
float(0.047)
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_int.phpt b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_int.phpt
similarity index 61%
rename from amqp-2.1.0/tests/amqpconnection_setRpcTimeout_int.phpt
rename to amqp-2.1.1/tests/amqpconnection_setRpcTimeout_int.phpt
index cd450b2..23f0517 100644
--- a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_int.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_int.phpt
@@ -1,19 +1,19 @@
--TEST--
AMQPConnection setRpcTimeout int
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$timeout = 3;
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setRpcTimeout($timeout);
var_dump($cnn->getRpcTimeout());
var_dump($timeout);
?>
--EXPECT--
float(3)
int(3)
diff --git a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_out_of_range.phpt b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_out_of_range.phpt
similarity index 69%
rename from amqp-2.1.0/tests/amqpconnection_setRpcTimeout_out_of_range.phpt
rename to amqp-2.1.1/tests/amqpconnection_setRpcTimeout_out_of_range.phpt
index e3ed13c..79b7471 100644
--- a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_out_of_range.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_out_of_range.phpt
@@ -1,22 +1,22 @@
--TEST--
AMQPConnection setRpcTimeout out of range
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
try {
$cnn->setRpcTimeout(-1);
} catch (Exception $e) {
echo get_class($e);
echo PHP_EOL;
echo $e->getMessage();
}
?>
--EXPECT--
AMQPConnectionException
Parameter 'rpcTimeout' must be greater than or equal to zero.
diff --git a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_string.phpt b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_string.phpt
similarity index 71%
rename from amqp-2.1.0/tests/amqpconnection_setRpcTimeout_string.phpt
rename to amqp-2.1.1/tests/amqpconnection_setRpcTimeout_string.phpt
index d1ae0da..f128dd7 100644
--- a/amqp-2.1.0/tests/amqpconnection_setRpcTimeout_string.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setRpcTimeout_string.phpt
@@ -1,25 +1,25 @@
--TEST--
AMQPConnection setRpcTimeout string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$timeout = ".34";
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setRpcTimeout($timeout);
var_dump($cnn->getRpcTimeout());
var_dump($timeout);
$timeout = "4.7e-2";
$cnn->setRpcTimeout($timeout);
var_dump($cnn->getRpcTimeout());
var_dump($timeout);
?>
--EXPECT--
float(0.34)
string(3) ".34"
float(0.047)
string(6) "4.7e-2"
diff --git a/amqp-2.1.0/tests/amqpconnection_setSaslMethod.phpt b/amqp-2.1.1/tests/amqpconnection_setSaslMethod.phpt
similarity index 73%
rename from amqp-2.1.0/tests/amqpconnection_setSaslMethod.phpt
rename to amqp-2.1.1/tests/amqpconnection_setSaslMethod.phpt
index a59ae36..1414844 100644
--- a/amqp-2.1.0/tests/amqpconnection_setSaslMethod.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setSaslMethod.phpt
@@ -1,25 +1,25 @@
--TEST--
AMQPConnection setSaslMethod int
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setSaslMethod(0);
var_dump($cnn->getSaslMethod());
$cnn->setSaslMethod(1);
var_dump($cnn->getSaslMethod());
$cnn->setSaslMethod(AMQP_SASL_METHOD_PLAIN);
var_dump($cnn->getSaslMethod());
$cnn->setSaslMethod(AMQP_SASL_METHOD_EXTERNAL);
var_dump($cnn->getSaslMethod());
?>
--EXPECT--
int(0)
int(1)
int(0)
int(1)
diff --git a/amqp-2.1.0/tests/amqpconnection_setSaslMethod_invalid.phpt b/amqp-2.1.1/tests/amqpconnection_setSaslMethod_invalid.phpt
similarity index 70%
rename from amqp-2.1.0/tests/amqpconnection_setSaslMethod_invalid.phpt
rename to amqp-2.1.1/tests/amqpconnection_setSaslMethod_invalid.phpt
index da7c640..e087ac8 100644
--- a/amqp-2.1.0/tests/amqpconnection_setSaslMethod_invalid.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setSaslMethod_invalid.phpt
@@ -1,22 +1,22 @@
--TEST--
AMQPConnection setSaslMethod invalid
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
try {
$cnn->setSaslMethod(-1);
} catch (Exception $e) {
echo get_class($e);
echo PHP_EOL;
echo $e->getMessage();
}
?>
--EXPECT--
AMQPConnectionException
Invalid SASL method given. Method must be AMQP_SASL_METHOD_PLAIN or AMQP_SASL_METHOD_EXTERNAL.
diff --git a/amqp-2.1.0/tests/amqpconnection_setTimeout_deprecated.phpt b/amqp-2.1.1/tests/amqpconnection_setTimeout_deprecated.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpconnection_setTimeout_deprecated.phpt
rename to amqp-2.1.1/tests/amqpconnection_setTimeout_deprecated.phpt
index 92b1a62..db94944 100644
--- a/amqp-2.1.0/tests/amqpconnection_setTimeout_deprecated.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setTimeout_deprecated.phpt
@@ -1,16 +1,16 @@
--TEST--
AMQPConnection setTimeout deprecated
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setTimeout(0);
$cnn->getTimeout();
?>
--EXPECTF--
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 3
%s: AMQPConnection::getTimeout(): AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead in %s on line 4
diff --git a/amqp-2.1.0/tests/amqpconnection_setTimeout_float.phpt b/amqp-2.1.1/tests/amqpconnection_setTimeout_float.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpconnection_setTimeout_float.phpt
rename to amqp-2.1.1/tests/amqpconnection_setTimeout_float.phpt
index d5006ec..1a03b76 100644
--- a/amqp-2.1.0/tests/amqpconnection_setTimeout_float.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setTimeout_float.phpt
@@ -1,23 +1,23 @@
--TEST--
AMQPConnection setTimeout float
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setTimeout(.34);
var_dump($cnn->getTimeout());
$cnn->setTimeout(4.7e-2);
var_dump($cnn->getTimeout());?>
--EXPECTF--
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 3
%s: AMQPConnection::getTimeout(): AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead in %s on line 4
float(0.34)
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 5
%s: AMQPConnection::getTimeout(): AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead in %s on line 6
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_setTimeout_int.phpt b/amqp-2.1.1/tests/amqpconnection_setTimeout_int.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpconnection_setTimeout_int.phpt
rename to amqp-2.1.1/tests/amqpconnection_setTimeout_int.phpt
index 06ab402..5a9c516 100644
--- a/amqp-2.1.0/tests/amqpconnection_setTimeout_int.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setTimeout_int.phpt
@@ -1,17 +1,17 @@
--TEST--
AMQPConnection setTimeout int
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setTimeout(3);
var_dump($cnn->getTimeout());
?>
--EXPECTF--
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 3
%s: AMQPConnection::getTimeout(): AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead in %s on line 4
float(3)
diff --git a/amqp-2.1.0/tests/amqpconnection_setTimeout_out_of_range.phpt b/amqp-2.1.1/tests/amqpconnection_setTimeout_out_of_range.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpconnection_setTimeout_out_of_range.phpt
rename to amqp-2.1.1/tests/amqpconnection_setTimeout_out_of_range.phpt
index 60bfddb..de5d95b 100644
--- a/amqp-2.1.0/tests/amqpconnection_setTimeout_out_of_range.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setTimeout_out_of_range.phpt
@@ -1,21 +1,21 @@
--TEST--
AMQPConnection setTimeout out of range
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
try {
$cnn->setTimeout(-1);
} catch (Exception $e) {
echo get_class($e);
echo PHP_EOL;
echo $e->getMessage();
}
?>
--EXPECTF--
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 4
AMQPConnectionException
Parameter 'timeout' must be greater than or equal to zero.
diff --git a/amqp-2.1.0/tests/amqpconnection_setTimeout_string.phpt b/amqp-2.1.1/tests/amqpconnection_setTimeout_string.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpconnection_setTimeout_string.phpt
rename to amqp-2.1.1/tests/amqpconnection_setTimeout_string.phpt
index 7464698..dd395bb 100644
--- a/amqp-2.1.0/tests/amqpconnection_setTimeout_string.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setTimeout_string.phpt
@@ -1,23 +1,23 @@
--TEST--
AMQPConnection setTimeout string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->setTimeout(".34");
var_dump($cnn->getTimeout());
$cnn->setTimeout("4.7e-2");
var_dump($cnn->getTimeout());?>
--EXPECTF--
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 3
%s: AMQPConnection::getTimeout(): AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead in %s on line 4
float(0.34)
%s: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line 5
%s: AMQPConnection::getTimeout(): AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead in %s on line 6
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_setVhost.phpt b/amqp-2.1.1/tests/amqpconnection_setVhost.phpt
similarity index 62%
rename from amqp-2.1.0/tests/amqpconnection_setVhost.phpt
rename to amqp-2.1.1/tests/amqpconnection_setVhost.phpt
index 3e8910c..f1b109e 100644
--- a/amqp-2.1.0/tests/amqpconnection_setVhost.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setVhost.phpt
@@ -1,17 +1,17 @@
--TEST--
AMQPConnection setVhost
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
var_dump($cnn->getVhost());
$cnn->setVhost('nonexistent');
var_dump($cnn->getVhost());
--EXPECTF--
string(1) "/"
string(11) "nonexistent"
diff --git a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_float.phpt b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_float.phpt
similarity index 65%
rename from amqp-2.1.0/tests/amqpconnection_setWriteTimeout_float.phpt
rename to amqp-2.1.1/tests/amqpconnection_setWriteTimeout_float.phpt
index ae3b2e6..3a1ac2c 100644
--- a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_float.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_float.phpt
@@ -1,18 +1,18 @@
--TEST--
AMQPConnection setWriteTimeout float
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setWriteTimeout(.34);
var_dump($cnn->getWriteTimeout());
$cnn->setWriteTimeout(4.7e-2);
var_dump($cnn->getWriteTimeout());?>
--EXPECT--
float(0.34)
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_int.phpt b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_int.phpt
similarity index 58%
rename from amqp-2.1.0/tests/amqpconnection_setWriteTimeout_int.phpt
rename to amqp-2.1.1/tests/amqpconnection_setWriteTimeout_int.phpt
index a36f322..cc4cd0d 100644
--- a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_int.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_int.phpt
@@ -1,16 +1,16 @@
--TEST--
AMQPConnection setWriteTimeout int
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setWriteTimeout(3);
var_dump($cnn->getWriteTimeout());
?>
--EXPECT--
float(3)
diff --git a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_out_of_range.phpt b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
similarity index 69%
rename from amqp-2.1.0/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
rename to amqp-2.1.1/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
index bb18929..b0cc4ac 100644
--- a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
@@ -1,22 +1,22 @@
--TEST--
AMQPConnection setWriteTimeout out of range
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
try {
$cnn->setWriteTimeout(-1);
} catch (Exception $e) {
echo get_class($e);
echo PHP_EOL;
echo $e->getMessage();
}
?>
--EXPECT--
AMQPConnectionException
Parameter 'writeTimeout' must be greater than or equal to zero.
diff --git a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_string.phpt b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_string.phpt
similarity index 65%
rename from amqp-2.1.0/tests/amqpconnection_setWriteTimeout_string.phpt
rename to amqp-2.1.1/tests/amqpconnection_setWriteTimeout_string.phpt
index 9209a8c..5f6036b 100644
--- a/amqp-2.1.0/tests/amqpconnection_setWriteTimeout_string.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_setWriteTimeout_string.phpt
@@ -1,19 +1,19 @@
--TEST--
AMQPConnection setWriteTimeout string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setWriteTimeout(".34");
var_dump($cnn->getWriteTimeout());
$cnn->setWriteTimeout("4.7e-2");
var_dump($cnn->getWriteTimeout());
?>
--EXPECT--
float(0.34)
float(0.047)
diff --git a/amqp-2.1.0/tests/amqpconnection_tls_basic.phpt b/amqp-2.1.1/tests/amqpconnection_tls_basic.phpt
similarity index 90%
rename from amqp-2.1.0/tests/amqpconnection_tls_basic.phpt
rename to amqp-2.1.1/tests/amqpconnection_tls_basic.phpt
index 0e7088c..f4b5e46 100644
--- a/amqp-2.1.0/tests/amqpconnection_tls_basic.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_tls_basic.phpt
@@ -1,116 +1,116 @@
--TEST--
AMQPConnection - TLS - CA validation only
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_SSL_HOST")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+elseif (!getenv("PHP_AMQP_SSL_HOST")) print "skip PHP_AMQP_SSL_HOST environment variable is not set";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem")) print "skip CA certificate is not available";
?>
--FILE--
<?php
$credentials = array(
'port' => 5671,
'host' => getenv('PHP_AMQP_SSL_HOST'),
'cacert' => __DIR__ . "/../infra/tls/certificates/testca/cacert.pem",
);
$cnn = new AMQPConnection($credentials);
var_dump($cnn);
$cnn->connect();
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
echo PHP_EOL;
$cnn = new AMQPConnection();
$cnn->setPort(5671);
$cnn->setHost(getenv('PHP_AMQP_SSL_HOST'));
$cnn->setCACert(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem");
var_dump($cnn);
$cnn->connect();
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
?>
--EXPECTF--
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5671)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(%d) "%s/testca/cacert.pem"
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
connected
object(AMQPConnection)#2 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5671)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(%d) "%s/testca/cacert.pem"
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
connected
diff --git a/amqp-2.1.0/tests/amqpconnection_tls_mtls.phpt b/amqp-2.1.1/tests/amqpconnection_tls_mtls.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpconnection_tls_mtls.phpt
rename to amqp-2.1.1/tests/amqpconnection_tls_mtls.phpt
index 1c8d928..dad6a3a 100644
--- a/amqp-2.1.0/tests/amqpconnection_tls_mtls.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_tls_mtls.phpt
@@ -1,122 +1,122 @@
--TEST--
AMQPConnection - TLS - mTLS support
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_SSL_HOST")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/client/cert.pem")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/client/key.pem")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+elseif (!getenv("PHP_AMQP_SSL_HOST")) print "skip PHP_AMQP_SSL_HOST environment variable is not set";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem")) print "skip CA certificate is not available";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/client/cert.pem")) print "skip client certificate is not available";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/client/key.pem")) print "skip client certificate key is not available";
?>
--FILE--
<?php
$credentials = array(
'port' => 5671,
'host' => getenv('PHP_AMQP_SSL_HOST'),
'cacert' => __DIR__ . "/../infra/tls/certificates/testca/cacert.pem",
'cert' => __DIR__ . "/../infra/tls/certificates/client/cert.pem",
'key' => __DIR__ . "/../infra/tls/certificates/client/key.pem",
);
$cnn = new AMQPConnection($credentials);
var_dump($cnn);
$cnn->connect();
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
echo PHP_EOL;
$cnn = new AMQPConnection();
$cnn->setPort(5671);
$cnn->setHost(getenv('PHP_AMQP_SSL_HOST'));
$cnn->setCACert(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem");
$cnn->setCert(__DIR__ . "/../infra/tls/certificates/client/cert.pem");
$cnn->setKey(__DIR__ . "/../infra/tls/certificates/client/key.pem");
var_dump($cnn);
$cnn->connect();
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
?>
--EXPECTF--
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5671)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(%d) "%s/testca/cacert.pem"
["key":"AMQPConnection":private]=>
string(%d) "%s/client/key.pem"
["cert":"AMQPConnection":private]=>
string(%d) "%s/client/cert.pem"
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
connected
object(AMQPConnection)#2 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5671)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(%d) "%s/testca/cacert.pem"
["key":"AMQPConnection":private]=>
string(%d) "%s/client/key.pem"
["cert":"AMQPConnection":private]=>
string(%d) "%s/client/cert.pem"
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
connected
diff --git a/amqp-2.1.0/tests/amqpconnection_tls_sasl.phpt b/amqp-2.1.1/tests/amqpconnection_tls_sasl.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpconnection_tls_sasl.phpt
rename to amqp-2.1.1/tests/amqpconnection_tls_sasl.phpt
index 6ef3697..728b15d 100644
--- a/amqp-2.1.0/tests/amqpconnection_tls_sasl.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_tls_sasl.phpt
@@ -1,126 +1,126 @@
--TEST--
AMQPConnection - TLS - SASL authentication
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_SSL_HOST")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/sasl-client/cert.pem")) print "skip";
-if (!file_exists(__DIR__ . "/../infra/tls/certificates/sasl-client/key.pem")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+elseif (!getenv("PHP_AMQP_SSL_HOST")) print "skip PHP_AMQP_SSL_HOST environment variable is not set";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem")) print "skip client certificate key is not available";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/sasl-client/cert.pem")) print "skip SASL client certificate is not available";
+elseif (!file_exists(__DIR__ . "/../infra/tls/certificates/sasl-client/key.pem")) print "skip SASL client certificate key is not available";
?>
--FILE--
<?php
$credentials = array(
'host' => getenv('PHP_AMQP_SSL_HOST'),
'port' => 5671,
'cacert' => __DIR__ . "/../infra/tls/certificates/testca/cacert.pem",
'cert' => __DIR__ . "/../infra/tls/certificates/sasl-client/cert.pem",
'key' => __DIR__ . "/../infra/tls/certificates/sasl-client/key.pem",
'sasl_method' => AMQP_SASL_METHOD_EXTERNAL,
);
$cnn = new AMQPConnection($credentials);
$cnn->setSaslMethod(1);
var_dump($cnn);
$cnn->connect();
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
echo PHP_EOL;
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_SSL_HOST'));
$cnn->setPort(5671);
$cnn->setCACert(__DIR__ . "/../infra/tls/certificates/testca/cacert.pem");
$cnn->setCert(__DIR__ . "/../infra/tls/certificates/sasl-client/cert.pem");
$cnn->setKey(__DIR__ . "/../infra/tls/certificates/sasl-client/key.pem");
$cnn->setSaslMethod(AMQP_SASL_METHOD_EXTERNAL);
var_dump($cnn);
$cnn->connect();
echo ($cnn->isConnected() ? 'connected' : 'disconnected'), PHP_EOL;
?>
--EXPECTF--
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5671)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(%d) "%s/testca/cacert.pem"
["key":"AMQPConnection":private]=>
string(%d) "%s/sasl-client/key.pem"
["cert":"AMQPConnection":private]=>
string(%d) "%s/sasl-client/cert.pem"
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(1)
["connectionName":"AMQPConnection":private]=>
NULL
}
connected
object(AMQPConnection)#2 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5671)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(%d) "%s/testca/cacert.pem"
["key":"AMQPConnection":private]=>
string(%d) "%s/sasl-client/key.pem"
["cert":"AMQPConnection":private]=>
string(%d) "%s/sasl-client/cert.pem"
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(1)
["connectionName":"AMQPConnection":private]=>
NULL
}
connected
diff --git a/amqp-2.1.0/tests/amqpconnection_toomanychannels.phpt b/amqp-2.1.1/tests/amqpconnection_toomanychannels.phpt
similarity index 80%
rename from amqp-2.1.0/tests/amqpconnection_toomanychannels.phpt
rename to amqp-2.1.1/tests/amqpconnection_toomanychannels.phpt
index 3a51c4a..521c71f 100644
--- a/amqp-2.1.0/tests/amqpconnection_toomanychannels.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_toomanychannels.phpt
@@ -1,33 +1,33 @@
--TEST--
AMQPConnection too many channels on a connection
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channels = array();
for ($i = 0; $i < PHP_AMQP_MAX_CHANNELS; $i++) {
$channel = $channels[] = new AMQPChannel($cnn);
//echo '#', $channel->getChannelId(), ', used ', $cnn->getUsedChannels(), ' of ', $cnn->getMaxChannels(), PHP_EOL;
}
echo "Good\n";
try {
new AMQPChannel($cnn);
echo "Bad\n";
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Good
AMQPChannelException(0): Could not create channel. Connection has no open channel slots remaining.
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_validation.phpt b/amqp-2.1.1/tests/amqpconnection_validation.phpt
similarity index 98%
rename from amqp-2.1.0/tests/amqpconnection_validation.phpt
rename to amqp-2.1.1/tests/amqpconnection_validation.phpt
index dae915e..9f67cf6 100644
--- a/amqp-2.1.0/tests/amqpconnection_validation.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_validation.phpt
@@ -1,112 +1,112 @@
--TEST--
AMQPConnection parameter validation
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$parameters = [
['login', 'setLogin', 'getLogin', [str_repeat('X', 1025), 'user']],
['password', 'setPassword', 'getPassword', [str_repeat('X', 1025), 'pass']],
['host', 'setHost', 'getHost', [str_repeat('X', 513), 'host']],
['vhost', 'setVhost', 'getVhost', [str_repeat('X', 513), 'vhost']],
['port', 'setPort', 'getPort', [-1, 65536, 1234]],
['timeout', 'setTimeout', 'getTimeout', [-1], 10],
['read_timeout', 'setReadTimeout', 'getReadTimeout', [-1, 20]],
['write_timeout', 'setWriteTimeout', 'getWriteTimeout', [-1, 30]],
['connect_timeout', null, 'getConnectTimeout', [-1, 40]],
['rpc_timeout', 'setRpcTimeout', 'getRpcTimeout', [-1, 50]],
['frame_max', null, 'getMaxFrameSize', [-1, PHP_INT_MAX + 1, 128]],
['channel_max', null, 'getMaxChannels', [-1, 257, 128]],
['heartbeat', null, 'getHeartbeatInterval', [-1, PHP_INT_MAX + 1, 250, 0]],
];
foreach ($parameters as $args) {
list($prop, $setter, $getter, $values) = $args;
foreach ($values as $value) {
try {
$con1 = new AMQPConnection([$prop => $value]);
echo $getter . " after constructor: ";
echo $con1->{$getter}();
echo PHP_EOL;
} catch (\Throwable $t) {
echo get_class($t);
echo ": ";
echo $t->getMessage();
echo PHP_EOL;
}
if ($setter === null) {
continue;
}
$con2 = new AMQPConnection();
try {
$con2->{$setter}($value);
echo $getter . " after setter: ";
echo $con2->{$getter}();
echo PHP_EOL;
} catch (\Throwable $t) {
echo get_class($t);
echo ": ";
echo $t->getMessage();
echo PHP_EOL;
}
}
}
?>
==DONE==
--EXPECTF--
AMQPConnectionException: Parameter 'login' exceeds 1024 character limit.
AMQPConnectionException: Parameter 'login' exceeds 1024 character limit.
getLogin after constructor: user
getLogin after setter: user
AMQPConnectionException: Parameter 'password' exceeds 1024 character limit.
AMQPConnectionException: Parameter 'password' exceeds 1024 character limit.
getPassword after constructor: pass
getPassword after setter: pass
AMQPConnectionException: Parameter 'host' exceeds 512 character limit.
AMQPConnectionException: Parameter 'host' exceeds 512 character limit.
getHost after constructor: host
getHost after setter: host
AMQPConnectionException: Parameter 'vhost' exceeds 512 character limit.
AMQPConnectionException: Parameter 'vhost' exceeds 512 characters limit.
getVhost after constructor: vhost
getVhost after setter: vhost
AMQPConnectionException: Parameter 'port' must be a valid port number between 1 and 65535.
AMQPConnectionException: Parameter 'port' must be a valid port number between 1 and 65535.
AMQPConnectionException: Parameter 'port' must be a valid port number between 1 and 65535.
AMQPConnectionException: Parameter 'port' must be a valid port number between 1 and 65535.
getPort after constructor: 1234
getPort after setter: 1234
Deprecated: AMQPConnection::__construct(): Parameter 'timeout' is deprecated; use 'read_timeout' instead in %s on line %d
AMQPConnectionException: Parameter 'timeout' must be greater than or equal to zero.
Deprecated: AMQPConnection::setTimeout(): AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead in %s on line %d
AMQPConnectionException: Parameter 'timeout' must be greater than or equal to zero.
AMQPConnectionException: Parameter 'read_timeout' must be greater than or equal to zero.
AMQPConnectionException: Parameter 'readTimeout' must be greater than or equal to zero.
getReadTimeout after constructor: 20
getReadTimeout after setter: 20
AMQPConnectionException: Parameter 'write_timeout' must be greater than or equal to zero.
AMQPConnectionException: Parameter 'writeTimeout' must be greater than or equal to zero.
getWriteTimeout after constructor: 30
getWriteTimeout after setter: 30
AMQPConnectionException: Parameter 'connect_timeout' must be greater than or equal to zero.
getConnectTimeout after constructor: 40
AMQPConnectionException: Parameter 'rpc_timeout' must be greater than or equal to zero.
AMQPConnectionException: Parameter 'rpcTimeout' must be greater than or equal to zero.
getRpcTimeout after constructor: 50
getRpcTimeout after setter: 50
AMQPConnectionException: Parameter 'frame_max' is out of range.
AMQPConnectionException: Parameter 'frame_max' is out of range.
getMaxFrameSize after constructor: 128
AMQPConnectionException: Parameter 'channel_max' is out of range.
AMQPConnectionException: Parameter 'channel_max' is out of range.
getMaxChannels after constructor: 128
AMQPConnectionException: Parameter 'heartbeat' is out of range.
AMQPConnectionException: Parameter 'heartbeat' is out of range.
getHeartbeatInterval after constructor: 250
getHeartbeatInterval after constructor: 0
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpconnection_var_dump.phpt b/amqp-2.1.1/tests/amqpconnection_var_dump.phpt
similarity index 95%
rename from amqp-2.1.0/tests/amqpconnection_var_dump.phpt
rename to amqp-2.1.1/tests/amqpconnection_var_dump.phpt
index 459b3e3..949dfbe 100644
--- a/amqp-2.1.0/tests/amqpconnection_var_dump.phpt
+++ b/amqp-2.1.1/tests/amqpconnection_var_dump.phpt
@@ -1,142 +1,142 @@
--TEST--
AMQPConnection var_dump
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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'));
var_dump($cnn->isConnected());
var_dump($cnn);
$cnn->connect();
var_dump($cnn->isConnected());
$cnn->connect();
var_dump($cnn->isConnected());
var_dump($cnn);
$cnn->disconnect();
var_dump($cnn->isConnected());
var_dump($cnn);
?>
--EXPECTF--
bool(false)
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
bool(true)
bool(true)
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
bool(false)
object(AMQPConnection)#1 (18) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(%d) "%s"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["readTimeout":"AMQPConnection":private]=>
float(0)
["writeTimeout":"AMQPConnection":private]=>
float(0)
["connectTimeout":"AMQPConnection":private]=>
float(0)
["rpcTimeout":"AMQPConnection":private]=>
float(0)
["frameMax":"AMQPConnection":private]=>
int(131072)
["channelMax":"AMQPConnection":private]=>
int(256)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
NULL
["key":"AMQPConnection":private]=>
NULL
["cert":"AMQPConnection":private]=>
NULL
["verify":"AMQPConnection":private]=>
bool(true)
["saslMethod":"AMQPConnection":private]=>
int(0)
["connectionName":"AMQPConnection":private]=>
NULL
}
diff --git a/amqp-2.1.0/tests/amqpdecimal.phpt b/amqp-2.1.1/tests/amqpdecimal.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpdecimal.phpt
rename to amqp-2.1.1/tests/amqpdecimal.phpt
index c973c87..88fdbc7 100644
--- a/amqp-2.1.0/tests/amqpdecimal.phpt
+++ b/amqp-2.1.1/tests/amqpdecimal.phpt
@@ -1,65 +1,65 @@
--TEST--
AMQPDecimal
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$decimal = new AMQPDecimal(1, 2);
var_dump($decimal->getExponent(), $decimal->getSignificand());
var_dump($decimal === $decimal->toAmqpValue());
var_dump($decimal instanceof AMQPValue);
try {
new AMQPDecimal(-1, 1);
} catch (AMQPValueException $e) {
echo $e->getMessage() . "\n";
}
try {
new AMQPDecimal(1, -1);
} catch (AMQPValueException $e) {
echo $e->getMessage() . "\n";
}
try {
new AMQPDecimal(AMQPDecimal::EXPONENT_MAX+1, 1);
} catch (AMQPValueException $e) {
echo $e->getMessage() . "\n";
}
try {
new AMQPDecimal(1, AMQPDecimal::SIGNIFICAND_MAX+1);
} catch (AMQPValueException $e) {
echo $e->getMessage() . "\n";
}
var_dump((new ReflectionClass("AMQPDecimal"))->isFinal());
var_dump(AMQPDecimal::EXPONENT_MIN);
var_dump(AMQPDecimal::EXPONENT_MAX);
var_dump(AMQPDecimal::SIGNIFICAND_MIN);
var_dump(AMQPDecimal::SIGNIFICAND_MAX);
?>
==END==
--EXPECT--
int(1)
int(2)
bool(true)
bool(true)
Decimal exponent value must be unsigned.
Decimal significand value must be unsigned.
Decimal exponent value must be less than 255.
Decimal significand value must be less than 4294967295.
bool(true)
int(0)
int(255)
int(0)
int(4294967295)
==END==
diff --git a/amqp-2.1.0/tests/amqpenvelope_construct.phpt b/amqp-2.1.1/tests/amqpenvelope_construct.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpenvelope_construct.phpt
rename to amqp-2.1.1/tests/amqpenvelope_construct.phpt
index a37eb25..90717f1 100644
--- a/amqp-2.1.0/tests/amqpenvelope_construct.phpt
+++ b/amqp-2.1.1/tests/amqpenvelope_construct.phpt
@@ -1,54 +1,54 @@
--TEST--
AMQPEnvelope construct
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
var_dump(new AMQPEnvelope());
?>
--EXPECT--
object(AMQPEnvelope)#1 (20) {
["contentType":"AMQPBasicProperties":private]=>
NULL
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
NULL
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
["body":"AMQPEnvelope":private]=>
string(0) ""
["consumerTag":"AMQPEnvelope":private]=>
NULL
["deliveryTag":"AMQPEnvelope":private]=>
NULL
["isRedelivery":"AMQPEnvelope":private]=>
bool(false)
["exchangeName":"AMQPEnvelope":private]=>
NULL
["routingKey":"AMQPEnvelope":private]=>
string(0) ""
}
diff --git a/amqp-2.1.0/tests/amqpenvelope_get_accessors.phpt b/amqp-2.1.1/tests/amqpenvelope_get_accessors.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpenvelope_get_accessors.phpt
rename to amqp-2.1.1/tests/amqpenvelope_get_accessors.phpt
index 1475814..9bebdf9 100644
--- a/amqp-2.1.0/tests/amqpenvelope_get_accessors.phpt
+++ b/amqp-2.1.1/tests/amqpenvelope_get_accessors.phpt
@@ -1,131 +1,131 @@
--TEST--
AMQPEnvelope test get*() accessors
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-'. bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
$ex->publish('message', 'routing.1', null, array('headers' => array('foo' => 'bar')));
// Read from the queue
$msg = $q->get(null);
var_dump($msg);
dump_message($msg);
$header = $msg->getHeader('foo');
var_dump($header);
$header = 'changed';
$header = $msg->getHeader('foo');
var_dump($header);
?>
--EXPECTF--
object(AMQPEnvelope)#5 (20) {
["contentType":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(1) {
["foo"]=>
string(3) "bar"
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
["body":"AMQPEnvelope":private]=>
string(7) "message"
["consumerTag":"AMQPEnvelope":private]=>
string(0) ""
["deliveryTag":"AMQPEnvelope":private]=>
int(1)
["isRedelivery":"AMQPEnvelope":private]=>
bool(false)
["exchangeName":"AMQPEnvelope":private]=>
string(%d) "exchange-%s"
["routingKey":"AMQPEnvelope":private]=>
string(9) "routing.1"
}
AMQPEnvelope
getBody:
string(7) "message"
getContentType:
string(10) "text/plain"
getRoutingKey:
string(9) "routing.1"
getConsumerTag:
string(0) ""
getDeliveryTag:
int(1)
getDeliveryMode:
int(1)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
NULL
getType:
NULL
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
NULL
getUserId:
NULL
getAppId:
NULL
getMessageId:
NULL
getReplyTo:
NULL
getCorrelationId:
NULL
getHeaders:
array(1) {
["foo"]=>
string(3) "bar"
}
string(3) "bar"
string(3) "bar"
diff --git a/amqp-2.1.0/tests/amqpenvelope_var_dump.phpt b/amqp-2.1.1/tests/amqpenvelope_var_dump.phpt
similarity index 95%
rename from amqp-2.1.0/tests/amqpenvelope_var_dump.phpt
rename to amqp-2.1.1/tests/amqpenvelope_var_dump.phpt
index 7aa10c5..968acba 100644
--- a/amqp-2.1.0/tests/amqpenvelope_var_dump.phpt
+++ b/amqp-2.1.1/tests/amqpenvelope_var_dump.phpt
@@ -1,123 +1,123 @@
--TEST--
AMQPEnvelope var_dump
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange1');
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
$ex->publish('message', 'routing.1');
$ex->publish('message', 'routing.1', AMQP_NOPARAM, array("headers" => array("test" => "passed")));
// Read from the queue
$q->consume("consumeThings");
$q->consume("consumeThings", null);
?>
--EXPECTF--
object(AMQPEnvelope)#5 (20) {
["contentType":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
["body":"AMQPEnvelope":private]=>
string(7) "message"
["consumerTag":"AMQPEnvelope":private]=>
string(31) "amq.ctag-%s"
["deliveryTag":"AMQPEnvelope":private]=>
int(1)
["isRedelivery":"AMQPEnvelope":private]=>
bool(false)
["exchangeName":"AMQPEnvelope":private]=>
string(9) "exchange1"
["routingKey":"AMQPEnvelope":private]=>
string(9) "routing.1"
}
object(AMQPEnvelope)#5 (20) {
["contentType":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(1) {
["test"]=>
string(6) "passed"
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
["body":"AMQPEnvelope":private]=>
string(7) "message"
["consumerTag":"AMQPEnvelope":private]=>
string(31) "amq.ctag-%s"
["deliveryTag":"AMQPEnvelope":private]=>
int(2)
["isRedelivery":"AMQPEnvelope":private]=>
bool(false)
["exchangeName":"AMQPEnvelope":private]=>
string(9) "exchange1"
["routingKey":"AMQPEnvelope":private]=>
string(9) "routing.1"
}
diff --git a/amqp-2.1.0/tests/amqpexchange-declare-segfault.phpt b/amqp-2.1.1/tests/amqpexchange-declare-segfault.phpt
similarity index 81%
rename from amqp-2.1.0/tests/amqpexchange-declare-segfault.phpt
rename to amqp-2.1.1/tests/amqpexchange-declare-segfault.phpt
index 7139663..9095161 100644
--- a/amqp-2.1.0/tests/amqpexchange-declare-segfault.phpt
+++ b/amqp-2.1.1/tests/amqpexchange-declare-segfault.phpt
@@ -1,40 +1,40 @@
--TEST--
AMQPExchange
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$name = "exchange-" . bin2hex(random_bytes(32));
$ex = new AMQPExchange(new AMQPChannel($cnn));
$ex->setName($name);
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
$ex2 = new AMQPExchange(new AMQPChannel($cnn));
$ex2->setName($name);
$ex2->setType(AMQP_EX_TYPE_DIRECT);
try {
$ex2->declareExchange();
} catch (AMQPExchangeException $e) {
echo get_class($e) . "\n";
try {
$ex2->delete();
} catch (AMQPChannelException $e) {
echo get_class($e) . "\n";
}
}
?>
=DONE=
--EXPECT--
AMQPExchangeException
AMQPChannelException
=DONE=
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_attributes.phpt b/amqp-2.1.1/tests/amqpexchange_attributes.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpexchange_attributes.phpt
rename to amqp-2.1.1/tests/amqpexchange_attributes.phpt
index 27e2559..fe56e2f 100644
--- a/amqp-2.1.0/tests/amqpexchange_attributes.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_attributes.phpt
@@ -1,43 +1,43 @@
--TEST--
AMQPExchange attributes
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setArguments($arr = array('existent' => 'value', 'false' => false, 'null' => null));
echo 'Initial args: ', count($arr), ', exchange args: ', count($ex->getArguments()), PHP_EOL;
$ex->setArgument('foo', 'bar');
echo 'Initial args: ', count($arr), ', exchange args: ', count($ex->getArguments()), PHP_EOL;
foreach (array('existent', 'false', 'null', 'nonexistent') as $key) {
echo "$key: ";
var_export($ex->hasArgument($key));
echo ', ';
try {
var_export($ex->getArgument($key));
} catch (AMQPExchangeException $e) {
echo "Ex: " . $e->getMessage();
}
echo PHP_EOL;
}
?>
--EXPECT--
Initial args: 3, exchange args: 3
Initial args: 3, exchange args: 4
existent: true, 'value'
false: true, false
null: true, NULL
nonexistent: false, Ex: The argument "nonexistent" does not exist
diff --git a/amqp-2.1.0/tests/amqpexchange_bind.phpt b/amqp-2.1.1/tests/amqpexchange_bind.phpt
similarity index 79%
rename from amqp-2.1.0/tests/amqpexchange_bind.phpt
rename to amqp-2.1.1/tests/amqpexchange_bind.phpt
index 7b1c916..c6b3dbd 100644
--- a/amqp-2.1.0/tests/amqpexchange_bind.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_bind.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPExchange::bind
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
var_dump($ex->bind($ex2->getName(), 'test-key-1'));
var_dump($ex->bind($ex2->getName(), 'test-key-1'));
?>
--EXPECT--
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_bind_with_arguments.phpt b/amqp-2.1.1/tests/amqpexchange_bind_with_arguments.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpexchange_bind_with_arguments.phpt
rename to amqp-2.1.1/tests/amqpexchange_bind_with_arguments.phpt
index 19d98a1..595a3a2 100644
--- a/amqp-2.1.0/tests/amqpexchange_bind_with_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_bind_with_arguments.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPExchange::bind with arguments
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
$time = microtime(true);
var_dump($ex->bind($ex2->getName(), 'test', array('test' => 'passed', 'at' => $time)));
var_dump($ex->bind($ex2->getName(), 'test', array('test' => 'passed', 'at' => $time)));
?>
--EXPECT--
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_bind_without_key.phpt b/amqp-2.1.1/tests/amqpexchange_bind_without_key.phpt
similarity index 80%
rename from amqp-2.1.0/tests/amqpexchange_bind_without_key.phpt
rename to amqp-2.1.1/tests/amqpexchange_bind_without_key.phpt
index b6753b9..3f0e063 100644
--- a/amqp-2.1.0/tests/amqpexchange_bind_without_key.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_bind_without_key.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPExchange::bind without key
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
var_dump($ex->bind($ex2->getName()));
var_dump($ex->bind($ex2->getName(), null));
var_dump($ex->bind($ex2->getName(), ''));
?>
--EXPECT--
NULL
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_bind_without_key_with_arguments.phpt b/amqp-2.1.1/tests/amqpexchange_bind_without_key_with_arguments.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpexchange_bind_without_key_with_arguments.phpt
rename to amqp-2.1.1/tests/amqpexchange_bind_without_key_with_arguments.phpt
index 8cc5001..6ee9598 100644
--- a/amqp-2.1.0/tests/amqpexchange_bind_without_key_with_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_bind_without_key_with_arguments.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPExchange::bind without key with arguments
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
$time = microtime(true);
var_dump($ex->bind($ex2->getName(), null, array('test' => 'passed', 'at' => $time, 'i am' => 'first')));
var_dump($ex->bind($ex2->getName(), '', array('test' => 'passed', 'at' => $time, 'i am' => 'second')));
?>
--EXPECT--
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_channel_refcount.phpt b/amqp-2.1.1/tests/amqpexchange_channel_refcount.phpt
similarity index 73%
rename from amqp-2.1.0/tests/amqpexchange_channel_refcount.phpt
rename to amqp-2.1.1/tests/amqpexchange_channel_refcount.phpt
index e391d63..7261c58 100644
--- a/amqp-2.1.0/tests/amqpexchange_channel_refcount.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_channel_refcount.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPExchange channel refcount
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
function buildExchange() {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("refcount-testing");
return $ex;
}
$ex = buildExchange();
echo $ex->getName() . "\n";
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
$ex->delete();
?>
--EXPECT--
refcount-testing
diff --git a/amqp-2.1.0/tests/amqpexchange_construct_basic.phpt b/amqp-2.1.1/tests/amqpexchange_construct_basic.phpt
similarity index 60%
rename from amqp-2.1.0/tests/amqpexchange_construct_basic.phpt
rename to amqp-2.1.1/tests/amqpexchange_construct_basic.phpt
index a4848d1..d352c36 100644
--- a/amqp-2.1.0/tests/amqpexchange_construct_basic.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_construct_basic.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPExchange constructor
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
echo get_class($ex);
?>
--EXPECT--
AMQPExchange
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_declare_basic.phpt b/amqp-2.1.1/tests/amqpexchange_declare_basic.phpt
similarity index 69%
rename from amqp-2.1.0/tests/amqpexchange_declare_basic.phpt
rename to amqp-2.1.1/tests/amqpexchange_declare_basic.phpt
index afef077..16ccfc3 100644
--- a/amqp-2.1.0/tests/amqpexchange_declare_basic.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_declare_basic.phpt
@@ -1,24 +1,24 @@
--TEST--
AMQPExchange
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ex->setName("exchange-" . bin2hex(random_bytes(32))));
var_dump($ex->setType(AMQP_EX_TYPE_FANOUT));
var_dump($ex->declareExchange());
?>
--EXPECT--
NULL
NULL
NULL
diff --git a/amqp-2.1.0/tests/amqpexchange_declare_existent.phpt b/amqp-2.1.1/tests/amqpexchange_declare_existent.phpt
similarity index 89%
rename from amqp-2.1.0/tests/amqpexchange_declare_existent.phpt
rename to amqp-2.1.1/tests/amqpexchange_declare_existent.phpt
index ce0bdbd..716ee27 100644
--- a/amqp-2.1.0/tests/amqpexchange_declare_existent.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_declare_existent.phpt
@@ -1,51 +1,51 @@
--TEST--
AMQPExchange
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
echo 'Channel id: ', $ch->getChannelId(), PHP_EOL;
$exchangge_name = "exchange-" . bin2hex(random_bytes(32));
$ex = new AMQPExchange($ch);
$ex->setName($exchangge_name);
$ex->setType(AMQP_EX_TYPE_FANOUT);
echo "Exchange declared: ", var_export($ex->declareExchange(), true), PHP_EOL;
try {
$ex = new AMQPExchange($ch);
$ex->setName($exchangge_name);
$ex->setType(AMQP_EX_TYPE_TOPIC);
$ex->declareExchange();
echo 'exchange ', $ex->getName(), ' declared', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo "Channel connected: ", $ch->isConnected() ? "true" : "false", PHP_EOL;
echo "Connection connected: ", $cnn->isConnected() ? "true" : "false", PHP_EOL;
try {
$ex = new AMQPExchange($ch);
echo "New exchange class created", PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Channel id: 1
Exchange declared: NULL
AMQPExchangeException(406): Server channel error: 406, message: PRECONDITION_FAILED - %s exchange 'exchange-%s' in vhost '/'%s
Channel connected: false
Connection connected: true
AMQPChannelException(0): Could not create exchange. No channel available.
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_declare_with_stalled_reference.phpt b/amqp-2.1.1/tests/amqpexchange_declare_with_stalled_reference.phpt
similarity index 91%
rename from amqp-2.1.0/tests/amqpexchange_declare_with_stalled_reference.phpt
rename to amqp-2.1.1/tests/amqpexchange_declare_with_stalled_reference.phpt
index 5540281..5799cab 100644
--- a/amqp-2.1.0/tests/amqpexchange_declare_with_stalled_reference.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_declare_with_stalled_reference.phpt
@@ -1,42 +1,42 @@
--TEST--
AMQPExchange - declare with stalled reference
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
class ConnectionMock extends AMQPConnection {
public function __construct(array $credentials = array())
{
}
}
class ChannelMock extends AMQPChannel {
public function __construct(AMQPConnection $amqp_connection)
{
}
}
class ExchangeMock extends \AMQPExchange
{
public function __construct(AMQPChannel $amqp_channel)
{
}
}
$cnn = new ConnectionMock();
$ch = new ChannelMock($cnn);
$e = new ExchangeMock($ch);
try {
$e->declareExchange();
} catch (\Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
AMQPChannelException(0): Could not declare exchange. Stale reference to the channel object.
diff --git a/amqp-2.1.0/tests/amqpexchange_declare_without_name.phpt b/amqp-2.1.1/tests/amqpexchange_declare_without_name.phpt
similarity index 76%
rename from amqp-2.1.0/tests/amqpexchange_declare_without_name.phpt
rename to amqp-2.1.1/tests/amqpexchange_declare_without_name.phpt
index 4b27587..bf56160 100644
--- a/amqp-2.1.0/tests/amqpexchange_declare_without_name.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_declare_without_name.phpt
@@ -1,28 +1,28 @@
--TEST--
AMQPExchange::declareExchange() without name set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setType(AMQP_EX_TYPE_FANOUT);
try {
$ex->declareExchange();
echo 'Exchange declared', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
AMQPExchangeException(0): Could not declare exchange. Exchanges must have a name.
diff --git a/amqp-2.1.0/tests/amqpexchange_declare_without_type.phpt b/amqp-2.1.1/tests/amqpexchange_declare_without_type.phpt
similarity index 78%
rename from amqp-2.1.0/tests/amqpexchange_declare_without_type.phpt
rename to amqp-2.1.1/tests/amqpexchange_declare_without_type.phpt
index 856652e..e534a43 100644
--- a/amqp-2.1.0/tests/amqpexchange_declare_without_type.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_declare_without_type.phpt
@@ -1,29 +1,29 @@
--TEST--
AMQPExchange::declareExchange() without type set
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$exchangge_name = "exchange-" . bin2hex(random_bytes(32));
$ex = new AMQPExchange($ch);
$ex->setName($exchangge_name);
try {
$ex->declareExchange();
echo 'Exchange declared', PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
AMQPExchangeException(0): Could not declare exchange. Exchanges must have a type.
diff --git a/amqp-2.1.0/tests/amqpexchange_delete_default_exchange.phpt b/amqp-2.1.1/tests/amqpexchange_delete_default_exchange.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpexchange_delete_default_exchange.phpt
rename to amqp-2.1.1/tests/amqpexchange_delete_default_exchange.phpt
index 6ec83b5..8ea80d0 100644
--- a/amqp-2.1.0/tests/amqpexchange_delete_default_exchange.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_delete_default_exchange.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPExchange::delete()
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
echo 'Channel id: ', $ch->getChannelId(), PHP_EOL;
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
try {
$ex->delete();
} catch (AMQPExchangeException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo "Channel connected: ", $ch->isConnected() ? "true" : "false", PHP_EOL;
echo "Connection connected: ", $cnn->isConnected() ? "true" : "false", PHP_EOL;
?>
--EXPECT--
Channel id: 1
AMQPExchangeException(403): Server channel error: 403, message: ACCESS_REFUSED - operation not permitted on the default exchange
Channel connected: false
Connection connected: true
diff --git a/amqp-2.1.0/tests/amqpexchange_delete_null_name.phpt b/amqp-2.1.1/tests/amqpexchange_delete_null_name.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpexchange_delete_null_name.phpt
rename to amqp-2.1.1/tests/amqpexchange_delete_null_name.phpt
index c6b1b2a..85c9a5e 100644
--- a/amqp-2.1.0/tests/amqpexchange_delete_null_name.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_delete_null_name.phpt
@@ -1,29 +1,29 @@
--TEST--
AMQPExchange::delete with explicit null as exchange name
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$chan = new AMQPChannel($cnn);
$ex = new AMQPExchange($chan);
$ex->setName('test.queue.' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declareExchange();
$ex->delete(null, null);
// Deleting with explicit null deleted the current exchange, so we should be able to redeclare
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->delete();
?>
==DONE==
--EXPECT--
==DONE==
diff --git a/amqp-2.1.0/tests/amqpexchange_get_channel.phpt b/amqp-2.1.1/tests/amqpexchange_get_channel.phpt
similarity index 78%
rename from amqp-2.1.0/tests/amqpexchange_get_channel.phpt
rename to amqp-2.1.1/tests/amqpexchange_get_channel.phpt
index 420bdb3..9278280 100644
--- a/amqp-2.1.0/tests/amqpexchange_get_channel.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_get_channel.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPExchange getChannel() test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$ch2 = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
echo $ch === $ex->getChannel() ? 'same' : 'not same', PHP_EOL;
echo $ch2 === $ex->getChannel() ? 'same' : 'not same', PHP_EOL;
$old_prefetch = $ch->getPrefetchCount();
$new_prefetch = 999;
$ex->getChannel()->setPrefetchCount($new_prefetch);
echo $ch->getPrefetchCount() == $new_prefetch ? 'by ref' : 'copy', PHP_EOL;
?>
--EXPECT--
same
not same
by ref
diff --git a/amqp-2.1.0/tests/amqpexchange_get_connection.phpt b/amqp-2.1.1/tests/amqpexchange_get_connection.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpexchange_get_connection.phpt
rename to amqp-2.1.1/tests/amqpexchange_get_connection.phpt
index 4fde3ac..7c0f73b 100644
--- a/amqp-2.1.0/tests/amqpexchange_get_connection.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_get_connection.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPExchange getConnection test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$cnn2 = new AMQPConnection();
echo $cnn === $ex->getConnection() ? 'same' : 'not same', PHP_EOL;
echo $cnn2 === $ex->getConnection() ? 'same' : 'not same', PHP_EOL;
$old_host = $cnn->getHost();
$new_host = 'test';
$ex->getConnection()->setHost($new_host);
echo $cnn->getHost() == $new_host ? 'by ref' : 'copy', PHP_EOL;
?>
--EXPECT--
same
not same
by ref
diff --git a/amqp-2.1.0/tests/amqpexchange_invalid_type.phpt b/amqp-2.1.1/tests/amqpexchange_invalid_type.phpt
similarity index 85%
rename from amqp-2.1.0/tests/amqpexchange_invalid_type.phpt
rename to amqp-2.1.1/tests/amqpexchange_invalid_type.phpt
index 215a1c7..3cee759 100644
--- a/amqp-2.1.0/tests/amqpexchange_invalid_type.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_invalid_type.phpt
@@ -1,38 +1,38 @@
--TEST--
AMQPExchange
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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("invalid_exchange_type");
echo "Channel ", $ch->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
echo "Connection ", $cnn->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
try {
$ex->declareExchange();
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo "Channel ", $ch->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
echo "Connection ", $cnn->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
?>
--EXPECT--
Channel connected
Connection connected
AMQPConnectionException(503): Server connection error: 503, message: COMMAND_INVALID - unknown exchange type 'invalid_exchange_type'
Channel disconnected
Connection disconnected
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_name.phpt b/amqp-2.1.1/tests/amqpexchange_name.phpt
similarity index 73%
rename from amqp-2.1.0/tests/amqpexchange_name.phpt
rename to amqp-2.1.1/tests/amqpexchange_name.phpt
index 4128283..bd15514 100644
--- a/amqp-2.1.0/tests/amqpexchange_name.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_name.phpt
@@ -1,31 +1,31 @@
--TEST--
AMQPExchange getConnection test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ex->getName());
$ex->setName('exchange');
var_dump($ex->getName());
$ex->setName('');
var_dump($ex->getName());
$ex->setName(null);
var_dump($ex->getName());
?>
==DONE==
--EXPECT--
NULL
string(8) "exchange"
NULL
NULL
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_basic.phpt b/amqp-2.1.1/tests/amqpexchange_publish_basic.phpt
similarity index 70%
rename from amqp-2.1.0/tests/amqpexchange_publish_basic.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_basic.phpt
index f982da4..916ec77 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_basic.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_basic.phpt
@@ -1,24 +1,24 @@
--TEST--
AMQPExchange
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
var_dump($ex->publish('message', 'routing.key'));
$ex->delete();
?>
--EXPECT--
NULL
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_confirms.phpt b/amqp-2.1.1/tests/amqpexchange_publish_confirms.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpexchange_publish_confirms.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_confirms.phpt
index 6941f24..8a29f1a 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_confirms.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_confirms.phpt
@@ -1,131 +1,132 @@
--TEST--
AMQPExchange::publish() - publish with confirms
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
<?php //print "skip - WIP"; ?>
--FILE--
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
echo $errstr, PHP_EOL;
}
set_error_handler('exception_error_handler');
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
//$cnn->setReadTimeout(2);
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->confirmSelect();
try {
$ch->waitForConfirm(1);
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
$ex1 = new AMQPExchange($ch);
$ex1->setName("exchange-" . bin2hex(random_bytes(32)));
$ex1->setType(AMQP_EX_TYPE_FANOUT);
$ex1->setFlags(AMQP_AUTODELETE);
$ex1->declareExchange();
var_dump($ex1->publish('message 1', 'routing.key'));
var_dump($ex1->publish('message 1', 'routing.key', AMQP_MANDATORY));
try {
$ch->waitForConfirm();
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
try {
$ch->waitForConfirm();
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
try {
$ch->waitForConfirm(1);
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
var_dump($ex1->publish('message 1', 'routing.key'));
var_dump($ex1->publish('message 1', 'routing.key', AMQP_MANDATORY));
// ack_callback(int $delivery_tag, bool $multiple) : bool;
// nack_callback(int $delivery_tag, bool $multiple, bool $requeue) : bool;
// return_callback(int $reply_code, string $reply_text, string $exchange, string $routing_key, AMQPBasicProperties $properties, string $body);
$ch->setReturnCallback(function ($reply_code, $reply_text, $exchange, $routing_key, AMQPBasicProperties $properties, $body) {
echo 'Message returned: ', $reply_text, ', message body:', $body, PHP_EOL;
});
$cnt = 2;
$ch->setConfirmCallback(function ($delivery_tag, $multiple) use(&$cnt) {
echo 'Message acked', PHP_EOL;
var_dump(func_get_args());
return --$cnt > 0;
}, function ($delivery_tag, $multiple, $requeue) {
echo 'Message nacked', PHP_EOL;
var_dump(func_get_args());
return false;
});
try {
$ch->waitForConfirm();
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
$ex1->delete();
$ex2 = new AMQPExchange($ch);
$ex2->setName("exchange-nonexistent-" . bin2hex(random_bytes(32)));
var_dump($ex2->publish('message 2', 'routing.key'));
try {
$ch->waitForConfirm(1);
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
?>
--EXPECTF--
AMQPQueueException(0): Wait timeout exceed
NULL
NULL
Unhandled basic.ack method from server received. Use AMQPChannel::setConfirmCallback() to process it.
Unhandled basic.return method from server received. Use AMQPChannel::setReturnCallback() to process it.
Unhandled basic.ack method from server received. Use AMQPChannel::setConfirmCallback() to process it.
NULL
NULL
Message acked
array(2) {
[0]=>
int(3)
[1]=>
bool(false)
}
Message returned: NO_ROUTE, message body:message 1
Message acked
array(2) {
[0]=>
int(4)
[1]=>
bool(false)
}
NULL
AMQPChannelException(404): Server channel error: 404, message: NOT_FOUND - no exchange 'exchange-nonexistent-%s' in vhost '/'
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_confirms_consume.phpt b/amqp-2.1.1/tests/amqpexchange_publish_confirms_consume.phpt
similarity index 91%
rename from amqp-2.1.0/tests/amqpexchange_publish_confirms_consume.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_confirms_consume.phpt
index f98008a..7900a34 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_confirms_consume.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_confirms_consume.phpt
@@ -1,101 +1,102 @@
--TEST--
AMQPExchange::publish() - publish in conform mode and handle conforms with AMQPQueue::consume() method
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
echo $errstr, PHP_EOL;
}
set_error_handler('exception_error_handler');
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setReadTimeout(2);
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch->confirmSelect();
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->setFlags(AMQP_AUTODELETE);
$ex->declareExchange();
var_dump($ex->publish('message 1', 'routing.key', AMQP_MANDATORY));
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
$msg = $q->get();
var_dump($msg);
try {
$q->consume(function() use ($q) {
echo 'Message returned', PHP_EOL;
var_dump(func_get_args());
return false;
});
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
var_dump($ex->publish('message 2', 'routing.key', AMQP_MANDATORY));
/* callback(int $reply_code, string $reply_text, string $exchange, string $routing_key, AMQPBasicProperties $properties, string $body); */
$ch->setReturnCallback(function ($reply_code, $reply_text, $exchange, $routing_key, AMQPBasicProperties $properties, $body) {
echo 'Message returned: ', $reply_text, ', message body:', $body, PHP_EOL;
});
$cnt = 1;
$ch->setConfirmCallback(function ($delivery_tag, $multiple) use(&$cnt) {
echo 'Message acked', PHP_EOL;
var_dump(func_get_args());
return --$cnt > 0;
}, function ($delivery_tag, $multiple, $requeue) {
echo 'Message nacked', PHP_EOL;
var_dump(func_get_args());
return false;
});
try {
$q->consume(function() use ($q) {
echo 'Received message', PHP_EOL;
var_dump(func_get_args());
return false;
});
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
$q->delete();
$ex->delete();
?>
--EXPECT--
NULL
NULL
Unhandled basic.return method from server received. Use AMQPChannel::setReturnCallback() to process it.
Unhandled basic.ack method from server received. Use AMQPChannel::setConfirmCallback() to process it.
AMQPQueueException(0): Consumer timeout exceed
NULL
Message returned: NO_ROUTE, message body:message 2
Message acked
array(2) {
[0]=>
int(2)
[1]=>
bool(false)
}
AMQPQueueException(0): Consumer timeout exceed
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_empty_routing_key.phpt b/amqp-2.1.1/tests/amqpexchange_publish_empty_routing_key.phpt
similarity index 71%
rename from amqp-2.1.0/tests/amqpexchange_publish_empty_routing_key.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_empty_routing_key.phpt
index ee9bd06..f9bbaf5 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_empty_routing_key.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_empty_routing_key.phpt
@@ -1,24 +1,24 @@
--TEST--
AMQPExchange publish with empty routing key
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
var_dump($ex->publish('message'));
$ex->delete();
?>
--EXPECT--
NULL
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_mandatory.phpt b/amqp-2.1.1/tests/amqpexchange_publish_mandatory.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpexchange_publish_mandatory.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_mandatory.phpt
index eeb53a1..d493f28 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_mandatory.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_mandatory.phpt
@@ -1,130 +1,131 @@
--TEST--
AMQPExchange::publish() - publish unroutable mandatory
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
<?php //print "skip - WIP"; ?>
--FILE--
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
echo $errstr, PHP_EOL;
}
set_error_handler('exception_error_handler');
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
//$cnn->setReadTimeout(2);
$cnn->connect();
$ch = new AMQPChannel($cnn);
try {
$ch->waitForBasicReturn(1);
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->setFlags(AMQP_AUTODELETE);
$ex->declareExchange();
var_dump($ex->publish('message 1', 'routing.key', AMQP_MANDATORY));
var_dump($ex->publish('message 2', 'routing.key', AMQP_MANDATORY));
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
$msg = $q->get();
var_dump($msg);
try {
$ch->waitForBasicReturn();
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
/* callback(int $reply_code, string $reply_text, string $exchange, string $routing_key, AMQPBasicProperties $properties, string $body); */
$ch->setReturnCallback(function ($reply_code, $reply_text, $exchange, $routing_key, AMQPBasicProperties $properties, $body) {
echo 'Message returned', PHP_EOL;
var_dump(func_get_args());
return false;
});
try {
$ch->waitForBasicReturn();
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
$q->delete();
$ex->delete();
?>
--EXPECTF--
AMQPQueueException(0): Wait timeout exceed
NULL
NULL
NULL
Unhandled basic.return method from server received. Use AMQPChannel::setReturnCallback() to process it.
Message returned
array(6) {
[0]=>
int(312)
[1]=>
string(8) "NO_ROUTE"
[2]=>
string(%d) "exchange-%s"
[3]=>
string(11) "routing.key"
[4]=>
object(AMQPBasicProperties)#7 (14) {
["contentType":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
}
[5]=>
string(9) "message 2"
}
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_mandatory_consume.phpt b/amqp-2.1.1/tests/amqpexchange_publish_mandatory_consume.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpexchange_publish_mandatory_consume.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_mandatory_consume.phpt
index d1da386..fe8fe4d 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_mandatory_consume.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_mandatory_consume.phpt
@@ -1,129 +1,130 @@
--TEST--
AMQPExchange::publish() - publish unroutable with mandatory flag and handle them with AMQPQueue::consume() method
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
echo $errstr, PHP_EOL;
}
set_error_handler('exception_error_handler');
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setReadTimeout(2);
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->setFlags(AMQP_AUTODELETE);
$ex->declareExchange();
var_dump($ex->publish('message 1', 'routing.key', AMQP_MANDATORY));
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
$msg = $q->get();
var_dump($msg);
try {
$q->consume(function() use ($q) {
echo 'Message returned', PHP_EOL;
var_dump(func_get_args());
return false;
});
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
var_dump($ex->publish('message 2', 'routing.key', AMQP_MANDATORY));
/* callback(int $reply_code, string $reply_text, string $exchange, string $routing_key, AMQPBasicProperties $properties, string $body); */
$ch->setReturnCallback(function ($reply_code, $reply_text, $exchange, $routing_key, AMQPBasicProperties $properties, $body) {
echo 'Message returned', PHP_EOL;
var_dump(func_get_args());
});
try {
$q->consume(function() use ($q) {
echo 'Received message', PHP_EOL;
var_dump(func_get_args());
return false;
});
} catch(Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(). PHP_EOL;
}
$q->delete();
$ex->delete();
?>
--EXPECTF--
NULL
NULL
Unhandled basic.return method from server received. Use AMQPChannel::setReturnCallback() to process it.
AMQPQueueException(0): Consumer timeout exceed
NULL
Message returned
array(6) {
[0]=>
int(312)
[1]=>
string(8) "NO_ROUTE"
[2]=>
string(%d) "exchange-%s"
[3]=>
string(11) "routing.key"
[4]=>
object(AMQPBasicProperties)#9 (14) {
["contentType":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["contentEncoding":"AMQPBasicProperties":private]=>
NULL
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["deliveryMode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlationId":"AMQPBasicProperties":private]=>
NULL
["replyTo":"AMQPBasicProperties":private]=>
NULL
["expiration":"AMQPBasicProperties":private]=>
NULL
["messageId":"AMQPBasicProperties":private]=>
NULL
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
NULL
["userId":"AMQPBasicProperties":private]=>
NULL
["appId":"AMQPBasicProperties":private]=>
NULL
["clusterId":"AMQPBasicProperties":private]=>
NULL
}
[5]=>
string(9) "message 2"
}
AMQPQueueException(0): Consumer timeout exceed
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt b/amqp-2.1.1/tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt
similarity index 88%
rename from amqp-2.1.0/tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt
index 1674c53..0958e36 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt
@@ -1,85 +1,86 @@
--TEST--
AMQPExchange::publish() - publish unroutable mandatory on multiple channels pitfall
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
echo $errstr, PHP_EOL;
}
set_error_handler('exception_error_handler');
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch1 = new AMQPChannel($cnn);
try {
$ch1->waitForBasicReturn(1);
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage() . PHP_EOL;
}
$ch2 = new AMQPChannel($cnn);
try {
$ch2->waitForBasicReturn(1);
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage() . PHP_EOL;
}
$exchange_name = "exchange-" . bin2hex(random_bytes(32));
$ex1 = new AMQPExchange($ch1);
$ex1->setName($exchange_name);
$ex1->setType(AMQP_EX_TYPE_FANOUT);
$ex1->setFlags(AMQP_AUTODELETE);
$ex1->declareExchange();
$ex2 = new AMQPExchange($ch2);
$ex2->setName($exchange_name);
var_dump($ex2->publish('message 1-2', 'routing.key', AMQP_MANDATORY));
var_dump($ex2->publish('message 2-2', 'routing.key', AMQP_MANDATORY));
// Create a new queue
$q = new AMQPQueue($ch1);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
$msg = $q->get();
var_dump($msg);
try {
$ch1->waitForBasicReturn();
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
// This error happens because on a channel 1 we are expecting only messages withing channel 1, but inside current
// connection we already have pending message on channel 2
echo 'Connection active: ', ($cnn->isConnected() ? 'yes' : 'no');
?>
--EXPECTF--
AMQPQueueException(0): Wait timeout exceed
AMQPQueueException(0): Wait timeout exceed
NULL
NULL
NULL
AMQPException(0): unexpected method received
Connection active: no
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_null_routing_key.phpt b/amqp-2.1.1/tests/amqpexchange_publish_null_routing_key.phpt
similarity index 71%
rename from amqp-2.1.0/tests/amqpexchange_publish_null_routing_key.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_null_routing_key.phpt
index 09da5fc..a2fb787 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_null_routing_key.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_null_routing_key.phpt
@@ -1,24 +1,24 @@
--TEST--
AMQPExchange publish with null routing key
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
var_dump($ex->publish('message', null));
$ex->delete();
?>
--EXPECT--
NULL
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_decimal_header.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_decimal_header.phpt
similarity index 87%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_decimal_header.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_decimal_header.phpt
index cea70b3..5104fd1 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_decimal_header.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_decimal_header.phpt
@@ -1,59 +1,59 @@
--TEST--
AMQPExchange publish with decimal header
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($ex->getName());
$headers = ['headerName' => new AMQPDecimal(123, 456)];
$ex->publish('message', 'routing.key', AMQP_NOPARAM, array('headers' => $headers));
$message =$q->get(AMQP_AUTOACK);
var_dump($message->getHeaders());
var_dump($headers);
echo $message->getHeaders() == $headers ? 'same' : 'differs';
?>
==DONE==
--EXPECTF--
array(1) {
["headerName"]=>
object(AMQPDecimal)#7 (2) {
["exponent":"AMQPDecimal":private]=>
int(123)
["significand":"AMQPDecimal":private]=>
int(456)
}
}
array(1) {
["headerName"]=>
object(AMQPDecimal)#5 (2) {
["exponent":"AMQPDecimal":private]=>
int(123)
["significand":"AMQPDecimal":private]=>
int(456)
}
}
same
==DONE==
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_null.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_null.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_null.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_null.phpt
index 9737540..58d0a95 100644
Binary files a/amqp-2.1.0/tests/amqpexchange_publish_with_null.phpt and b/amqp-2.1.1/tests/amqpexchange_publish_with_null.phpt differ
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_properties.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_properties.phpt
similarity index 95%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_properties.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_properties.phpt
index 4bc4bc7..cba3b0f 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_properties.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_properties.phpt
@@ -1,118 +1,118 @@
--TEST--
AMQPExchange publish with properties
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
require '_test_helpers.php.inc';
$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_FANOUT);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->declareQueue();
$q->bind($ex->getName());
$attrs = array(
'content_type' => 1, // should be string
'content_encoding' => 2, // should be string
'message_id' => 3, // should be string
//'user_id' => 4, // should be string // NOTE: fail due to Validated User-ID https://www.rabbitmq.com/validated-user-id.html, @see tests/amqpexchange_publish_with_properties_user_id_failure.phpt test
'app_id' => 5, // should be string
'delivery_mode' => '1-non-persistent', // should be long
'priority' => '2high', // should be long
'timestamp' => '123now', // should be long
'expiration' => 100000000, // should be string // NOTE: in fact it is milliseconds for how long to stay in queue, see https://www.rabbitmq.com/ttl.html#per-message-ttl for details
'type' => 7, // should be string
'reply_to' => 8, // should be string
'correlation_id' => 9, // should be string
//'headers' => 'not array', // should be array // NOTE: covered in tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
);
$attrs_control = array(
'content_type' => 1, // should be string
'content_encoding' => 2, // should be string
'message_id' => 3, // should be string
//'user_id' => 4, // should be string // NOTE: fail due to Validated User-ID https://www.rabbitmq.com/validated-user-id.html, @see tests/amqpexchange_publish_with_properties_user_id_failure.phpt test
'app_id' => 5, // should be string
'delivery_mode' => '1-non-persistent', // should be long
'priority' => '2high', // should be long
'timestamp' => '123now', // should be long
'expiration' => 100000000, // should be string // NOTE: in fact it is milliseconds for how long to stay in queue, see https://www.rabbitmq.com/ttl.html#per-message-ttl for details
'type' => 7, // should be string
'reply_to' => 8, // should be string
'correlation_id' => 9, // should be string
//'headers' => 'not array', // should be array // NOTE: covered in tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
);
var_dump($ex->publish('message', 'routing.key', AMQP_NOPARAM, $attrs));
//var_dump($attrs, $attrs_control);
echo 'Message attributes are ', $attrs === $attrs_control ? 'the same' : 'not the same', PHP_EOL;
$msg = $q->get(AMQP_AUTOACK);
dump_message($msg);
$ex->delete();
$q->delete();
?>
--EXPECTF--
NULL
Message attributes are the same
AMQPEnvelope
getBody:
string(7) "message"
getContentType:
string(1) "1"
getRoutingKey:
string(11) "routing.key"
getConsumerTag:
string(0) ""
getDeliveryTag:
int(1)
getDeliveryMode:
int(1)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
string(1) "2"
getType:
string(1) "7"
getTimeStamp:
int(123)
getPriority:
int(2)
getExpiration:
string(9) "100000000"
getUserId:
NULL
getAppId:
string(1) "5"
getMessageId:
string(1) "3"
getReplyTo:
string(1) "8"
getCorrelationId:
string(1) "9"
getHeaders:
array(0) {
}
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
index 8aec924..c96c0ae 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPExchange publish with properties - ignore numeric keys in headers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
var_dump($ex->publish('message', 'routing.key', AMQP_NOPARAM, array('headers' => 'ignored')));
var_dump($ex->publish('message', 'routing.key', AMQP_NOPARAM, array('headers' => array(2 => 'ignore_me'))));
$ex->delete();
?>
--EXPECTF--
Warning: AMQPExchange::publish(): Ignoring non-string header field '0' in %s on line %d
NULL
Warning: AMQPExchange::publish(): Ignoring non-string header field '2' in %s on line %d
NULL
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
index 57430e4..9b4a327 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
@@ -1,39 +1,39 @@
--TEST--
AMQPExchange publish with properties - ignore unsupported header values (NULL, object, resources)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
$attrs = array(
'headers' => array(
'null' => null,
'object' => new stdClass(),
'resource' => fopen(__FILE__, 'r'),
),
);
var_dump($ex->publish('message', 'routing.key', AMQP_NOPARAM, $attrs));
$ex->delete();
?>
--EXPECTF--
Warning: AMQPExchange::publish(): Ignoring field 'object' due to unsupported value type (object) in %s on line %d
Warning: AMQPExchange::publish(): Ignoring field 'resource' due to unsupported value type (resource) in %s on line %d
NULL
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_nested_header.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_nested_header.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_properties_nested_header.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_properties_nested_header.phpt
index 33c10c7..89c98f9 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_nested_header.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_nested_header.phpt
@@ -1,144 +1,144 @@
--TEST--
AMQPExchange publish with properties - nested header values
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($ex->getName());
$headers = array(
'nested' => array(
'string' => 'passed',
999 => 'numeric works',
'sub-nested' => array(
'should' => 'works',
42 => 'too'
),
),
);
$ex->publish('message', 'routing.key', AMQP_NOPARAM, array('headers' => $headers));
$message = $q->get(AMQP_AUTOACK);
var_dump($message->getHeaders());
var_dump($headers);
echo $message->getHeaders() === $headers ? 'same' : 'differs';
echo PHP_EOL, PHP_EOL;
$headers = array(
'x-death' => array(
array (
'reason' => 'rejected',
'queue' => 'my_queue',
'time' => 1410527691,
'exchange' => 'my_exchange',
'routing-keys' => array ('my_routing_key')
)
)
);
$ex->publish('message', 'routing.key', AMQP_NOPARAM, array('headers' => $headers));
$message = $q->get(AMQP_AUTOACK);
var_dump($message->getHeaders());
var_dump($headers);
echo $message->getHeaders() === $headers ? 'same' : 'differs';
echo PHP_EOL, PHP_EOL;
?>
--EXPECT--
array(1) {
["nested"]=>
array(3) {
["string"]=>
string(6) "passed"
[999]=>
string(13) "numeric works"
["sub-nested"]=>
array(2) {
["should"]=>
string(5) "works"
[42]=>
string(3) "too"
}
}
}
array(1) {
["nested"]=>
array(3) {
["string"]=>
string(6) "passed"
[999]=>
string(13) "numeric works"
["sub-nested"]=>
array(2) {
["should"]=>
string(5) "works"
[42]=>
string(3) "too"
}
}
}
same
array(1) {
["x-death"]=>
array(1) {
[0]=>
array(5) {
["reason"]=>
string(8) "rejected"
["queue"]=>
string(8) "my_queue"
["time"]=>
int(1410527691)
["exchange"]=>
string(11) "my_exchange"
["routing-keys"]=>
array(1) {
[0]=>
string(14) "my_routing_key"
}
}
}
}
array(1) {
["x-death"]=>
array(1) {
[0]=>
array(5) {
["reason"]=>
string(8) "rejected"
["queue"]=>
string(8) "my_queue"
["time"]=>
int(1410527691)
["exchange"]=>
string(11) "my_exchange"
["routing-keys"]=>
array(1) {
[0]=>
string(14) "my_routing_key"
}
}
}
}
same
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_user_id_failure.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
similarity index 91%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
index ee1cf0b..fff890c 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
@@ -1,58 +1,58 @@
--TEST--
AMQPExchange publish with properties - user_id failure
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
echo "Channel ", $ch->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
echo "Connection ", $cnn->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
try {
// NOTE: basic.publish is asynchronous, so ...
var_dump($ex->publish('message', 'routing.key', AMQP_NOPARAM, array('user_id' => 'unknown-' . bin2hex(random_bytes(32)))));
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo "Channel ", $ch->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
echo "Connection ", $cnn->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
try {
// NOTE: ... the next socket (not only channel) operation will fail, which may lead to very strange issues
// if we operate here,on different entity, for example on queue.
$q = new AMQPQueue($ch);
$q->declareQueue();
echo "Queue declared", PHP_EOL;
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
echo "Channel ", $ch->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
echo "Connection ", $cnn->isConnected() ? 'connected' : 'disconnected', PHP_EOL;
?>
--EXPECTF--
Channel connected
Connection connected
NULL
Channel connected
Connection connected
AMQPQueueException(406): Server channel error: 406, message: PRECONDITION_FAILED - user_id property set to 'unknown-%s' but authenticated user was 'guest'
Channel disconnected
Connection connected
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_with_timestamp_header.phpt b/amqp-2.1.1/tests/amqpexchange_publish_with_timestamp_header.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpexchange_publish_with_timestamp_header.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_with_timestamp_header.phpt
index f9c9cfb..169617f 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_with_timestamp_header.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_with_timestamp_header.phpt
@@ -1,55 +1,55 @@
--TEST--
AMQPExchange publish with timestamp header
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($ex->getName());
$headers = ['headerName' => new AMQPTimestamp(1488578462)];
$ex->publish('message', 'routing.key', AMQP_NOPARAM, array('headers' => $headers));
$message =$q->get(AMQP_AUTOACK);
var_dump($message->getHeaders());
var_dump($headers);
echo $message->getHeaders() == $headers ? 'same' : 'differs';
?>
==DONE==
--EXPECTF--
array(1) {
["headerName"]=>
object(AMQPTimestamp)#%d (1) {
["timestamp":"AMQPTimestamp":private]=>
float(1488578462)
}
}
array(1) {
["headerName"]=>
object(AMQPTimestamp)#%d (1) {
["timestamp":"AMQPTimestamp":private]=>
float(1488578462)
}
}
same
==DONE==
diff --git a/amqp-2.1.0/tests/amqpexchange_publish_xdeath.phpt b/amqp-2.1.1/tests/amqpexchange_publish_xdeath.phpt
similarity index 96%
rename from amqp-2.1.0/tests/amqpexchange_publish_xdeath.phpt
rename to amqp-2.1.1/tests/amqpexchange_publish_xdeath.phpt
index 0346fcc..ee663ba 100644
--- a/amqp-2.1.0/tests/amqpexchange_publish_xdeath.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_publish_xdeath.phpt
@@ -1,158 +1,158 @@
--TEST--
AMQPExchange publish with properties - nested header values
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$suffix = sha1(microtime(true));
$dlx = new AMQPExchange($ch);
$dlx->setName('dlx-' . $suffix);
$dlx->setType(AMQP_EX_TYPE_TOPIC);
$dlx->setFlags(AMQP_DURABLE);
$dlx->declareExchange();
$dq = new AMQPQueue($ch);
$dq->setName('dlx-' . $suffix);
$dq->declareQueue();
$dq->setFlags(AMQP_DURABLE);
$dq->bind($dlx->getName(), '#');
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . $suffix);
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->setFlags(AMQP_DURABLE);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('dlx-test-queue-' . $suffix);
$q->setFlags(AMQP_DURABLE);
$q->setArgument('x-dead-letter-exchange', $dlx->getName());
$q->declareQueue();
$q->bind($ex->getName());
$ex->publish('message');
function assert_xdeath(AMQPEnvelope $envelope, $exchangeName, $queueName) {
if (!$envelope->hasHeader('x-death')) {
return 'header-missing';
}
$originalHeader = $envelope->getHeader('x-death');
/**
* RabbitMQ 3.5.1 handles x-death headers differently: instead of growing the table x-death
* headers indefinitely it introduces a count field indexed by queue and reason. We normalize
* the headers to match the new format and to test against that
*
* https://github.com/rabbitmq/rabbitmq-server/releases/tag/rabbitmq_v3_5_1
* https://github.com/rabbitmq/rabbitmq-server/issues/78
* https://github.com/rabbitmq/rabbitmq-server/pull/79
*/
$header = [];
foreach ($originalHeader as $death) {
$index = $death['queue'] . $death['reason'];
$count = isset($death['count']) ? $death['count'] : 1;
if (!isset($header[$index])) {
$header[$index] = array_merge($death, ['count' => $count]);
} else {
$header[$index]['count'] += $count;
}
}
$header = array_values($header);
if (count($header) !== 1) {
return 'unexpected-number-of-headers-' . count($header) . ': ' . json_encode($header);
}
if (!isset($header[0]['reason']) || $header[0]['reason'] !== 'rejected') {
return 'unexpected-reason: ' . json_encode($header);
}
if (!isset($header[0]['time']) || !$header[0]['time'] instanceof AMQPTimestamp || $header[0]['time']->getTimestamp() < 1690465578) {
return 'unexpected-time: ' . json_encode($header);
}
if (!isset($header[0]['exchange']) || $header[0]['exchange'] !== $exchangeName) {
return 'unexpected-exchange: ' . json_encode($header);
}
if (!isset($header[0]['queue']) || $header[0]['queue'] !== $queueName) {
return 'unexpected-queue: ' . json_encode($header);
}
if (!isset($header[0]['routing-keys']) || $header[0]['routing-keys'] !== ['']) {
return 'unexpected-routing-keys: ' . json_encode($header);
}
if (!isset($header[0]['count'])) {
return 'count-missing: ' . json_encode($header);
}
return $header[0]['count'];
}
$envelope = $q->get();
var_dump(assert_xdeath($envelope, $ex->getName(), $q->getName()));
$q->nack($envelope->getDeliveryTag());
usleep(20000);
$failed = $dq->get();
var_dump(assert_xdeath($failed, $ex->getName(), $q->getName()));
$dq->ack($failed->getDeliveryTag());
$ex->publish(
$failed->getBody(),
$failed->getRoutingKey(),
AMQP_NOPARAM,
[
'content_type' => $failed->getContentType(),
'content_encoding' => $failed->getContentEncoding(),
'message_id' => $failed->getMessageId(),
'user_id' => $failed->getUserId(),
'app_id' => $failed->getAppId(),
'delivery_mode' => $failed->getDeliveryMode(),
'priority' => $failed->getPriority(),
'timestamp' => $failed->getTimeStamp(),
'expiration' => $failed->getExpiration(),
'type' => $failed->getType(),
'reply_to' => $failed->getReplyTo(),
'headers' => $failed->getHeaders(),
'correlation_id' => $failed->getCorrelationId(),
]
);
usleep(20000);
$envelope = $q->get();
var_dump(assert_xdeath($envelope, $ex->getName(), $q->getName()));
$q->nack($envelope->getDeliveryTag());
usleep(20000);
$failedTwice = $dq->get();
var_dump(assert_xdeath($failedTwice, $ex->getName(), $q->getName()));
$dq->ack($failedTwice->getDeliveryTag());
?>
==DONE==
--EXPECTF--
string(14) "header-missing"
int(1)
int(1)
int(2)
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_setArgument.phpt b/amqp-2.1.1/tests/amqpexchange_setArgument.phpt
similarity index 95%
rename from amqp-2.1.0/tests/amqpexchange_setArgument.phpt
rename to amqp-2.1.1/tests/amqpexchange_setArgument.phpt
index ba1b57a..c1def00 100644
--- a/amqp-2.1.0/tests/amqpexchange_setArgument.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_setArgument.phpt
@@ -1,135 +1,135 @@
--TEST--
AMQPExchange::setArgument() test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$credentials = array();
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$heartbeat = 10;
$e_name_ae = 'test.exchange.ae.' . bin2hex(random_bytes(32));
$e_name = 'test.exchange.' . bin2hex(random_bytes(32));
$ex_ae = new AMQPExchange($ch);
$ex_ae->setName($e_name_ae);
$ex_ae->setFlags(AMQP_AUTODELETE);
$ex_ae->setType(AMQP_EX_TYPE_FANOUT);
$ex_ae->declareExchange();
var_dump($ex_ae);
$ex = new AMQPExchange($ch);
$ex->setName($e_name);
$ex->setFlags(AMQP_AUTODELETE);
$ex->setType(AMQP_EX_TYPE_FANOUT);
// some real keys
$ex->setArgument("x-ha-policy", "all");
$ex->setArgument("alternate-exchange", $e_name_ae);
// some custom keys to test various cases
$ex->setArgument('x-empty-string', '');
$ex->setArgument('x-alternate-exchange-one-more-time', $e_name_ae);
$ex->setArgument('x-numeric-argument', $heartbeat * 10 * 1000);
$ex->setArgument('x-null-argument', null);
$ex->declareExchange();
var_dump($ex);
$ex->removeArgument('x-null-argument');
$ex->removeArgument('x-does-not-exist');
var_dump($ex);
?>
--EXPECTF--
object(AMQPExchange)#3 (9) {
["connection":"AMQPExchange":private]=>
%a
["channel":"AMQPExchange":private]=>
%a
["name":"AMQPExchange":private]=>
string(%d) "test.exchange.ae.%s"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["autoDelete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(0) {
}
}
object(AMQPExchange)#4 (9) {
["connection":"AMQPExchange":private]=>
%a
["channel":"AMQPExchange":private]=>
%a
["name":"AMQPExchange":private]=>
string(%d) "test.exchange.%s"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["autoDelete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(6) {
["x-ha-policy"]=>
string(3) "all"
["alternate-exchange"]=>
string(%d) "test.exchange.ae.%s"
["x-empty-string"]=>
string(0) ""
["x-alternate-exchange-one-more-time"]=>
string(%d) "test.exchange.ae.%s"
["x-numeric-argument"]=>
int(100000)
["x-null-argument"]=>
NULL
}
}
object(AMQPExchange)#4 (9) {
["connection":"AMQPExchange":private]=>
%a
["channel":"AMQPExchange":private]=>
%a
["name":"AMQPExchange":private]=>
string(%d) "test.exchange.%s"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["autoDelete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(5) {
["x-ha-policy"]=>
string(3) "all"
["alternate-exchange"]=>
string(%d) "test.exchange.ae.%s"
["x-empty-string"]=>
string(0) ""
["x-alternate-exchange-one-more-time"]=>
string(%d) "test.exchange.ae.%s"
["x-numeric-argument"]=>
int(100000)
}
}
diff --git a/amqp-2.1.0/tests/amqpexchange_set_flag.phpt b/amqp-2.1.1/tests/amqpexchange_set_flag.phpt
similarity index 69%
rename from amqp-2.1.0/tests/amqpexchange_set_flag.phpt
rename to amqp-2.1.1/tests/amqpexchange_set_flag.phpt
index 71c4cdf..fc2cfaa 100644
--- a/amqp-2.1.0/tests/amqpexchange_set_flag.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_set_flag.phpt
@@ -1,30 +1,30 @@
--TEST--
AMQPExchange set flag string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
echo $ex->getFlags();
$ex->setFlags("2");
echo $ex->getFlags();
$ex->setFlags(NULL);
echo $ex->getFlags();
$ex->setFlags(2);
echo $ex->getFlags();
?>
--EXPECT--
0202
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_set_flags.phpt b/amqp-2.1.1/tests/amqpexchange_set_flags.phpt
similarity index 85%
rename from amqp-2.1.0/tests/amqpexchange_set_flags.phpt
rename to amqp-2.1.1/tests/amqpexchange_set_flags.phpt
index eb33d5a..c95c247 100644
--- a/amqp-2.1.0/tests/amqpexchange_set_flags.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_set_flags.phpt
@@ -1,44 +1,44 @@
--TEST--
AMQPExchange setFlags()
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->setArguments(array("x-ha-policy" => "all"));
$ex->setFlags(AMQP_PASSIVE | AMQP_DURABLE | AMQP_AUTODELETE | AMQP_INTERNAL);
var_dump($ex);
?>
--EXPECTF--
object(AMQPExchange)#3 (9) {
["connection":"AMQPExchange":private]=>
%a
["name":"AMQPExchange":private]=>
string(%d) "exchange-%s"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(true)
["durable":"AMQPExchange":private]=>
bool(true)
["autoDelete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(true)
["arguments":"AMQPExchange":private]=>
array(1) {
["x-ha-policy"]=>
string(3) "all"
}
}
diff --git a/amqp-2.1.0/tests/amqpexchange_type.phpt b/amqp-2.1.1/tests/amqpexchange_type.phpt
similarity index 76%
rename from amqp-2.1.0/tests/amqpexchange_type.phpt
rename to amqp-2.1.1/tests/amqpexchange_type.phpt
index 7431a8f..33e1cd0 100644
--- a/amqp-2.1.0/tests/amqpexchange_type.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_type.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPExchange getConnection test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
var_dump($ex->getType());
$ex->setType(AMQP_EX_TYPE_FANOUT);
var_dump($ex->getType());
$ex->setType(null);
var_dump($ex->getType());
$ex->setType(AMQP_EX_TYPE_DIRECT);
var_dump($ex->getType());
$ex->setType("");
var_dump($ex->getType());
?>
==DONE==
--EXPECT--
NULL
string(6) "fanout"
NULL
string(6) "direct"
NULL
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_unbind.phpt b/amqp-2.1.1/tests/amqpexchange_unbind.phpt
similarity index 81%
rename from amqp-2.1.0/tests/amqpexchange_unbind.phpt
rename to amqp-2.1.1/tests/amqpexchange_unbind.phpt
index 01fa25a..ee214c8 100644
--- a/amqp-2.1.0/tests/amqpexchange_unbind.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_unbind.phpt
@@ -1,37 +1,37 @@
--TEST--
AMQPExchange::unbind
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-unbind-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-unbind-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
var_dump($ex->bind($ex2->getName(), 'test-key-1'));
var_dump($ex->unbind($ex2->getName(), 'test-key-1'));
var_dump($ex->unbind($ex2->getName(), 'test-key-1'));
?>
--EXPECT--
NULL
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_unbind_with_arguments.phpt b/amqp-2.1.1/tests/amqpexchange_unbind_with_arguments.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpexchange_unbind_with_arguments.phpt
rename to amqp-2.1.1/tests/amqpexchange_unbind_with_arguments.phpt
index a5814ba..e3b0ac3 100644
--- a/amqp-2.1.0/tests/amqpexchange_unbind_with_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_unbind_with_arguments.phpt
@@ -1,39 +1,39 @@
--TEST--
AMQPExchange::unbind with arguments
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-unbind-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-exchange-unbind-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
$time = microtime(true);
var_dump($ex->bind($ex2->getName(), 'test', array('test' => 'passed', 'at' => $time)));
var_dump($ex->unbind($ex2->getName(), 'test', array('test' => 'passed', 'at' => $time)));
var_dump($ex->unbind($ex2->getName(), 'test', array('test' => 'passed', 'at' => $time)));
?>
--EXPECT--
NULL
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_unbind_without_key.phpt b/amqp-2.1.1/tests/amqpexchange_unbind_without_key.phpt
similarity index 80%
rename from amqp-2.1.0/tests/amqpexchange_unbind_without_key.phpt
rename to amqp-2.1.1/tests/amqpexchange_unbind_without_key.phpt
index 623138f..8680d5e 100644
--- a/amqp-2.1.0/tests/amqpexchange_unbind_without_key.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_unbind_without_key.phpt
@@ -1,37 +1,37 @@
--TEST--
AMQPExchange::unbind without key
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-unbind-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-unbind-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
var_dump($ex->bind($ex2->getName()));
var_dump($ex->unbind($ex2->getName()));
var_dump($ex->unbind($ex2->getName()));
?>
--EXPECT--
NULL
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_unbind_without_key_with_arguments.phpt b/amqp-2.1.1/tests/amqpexchange_unbind_without_key_with_arguments.phpt
similarity index 88%
rename from amqp-2.1.0/tests/amqpexchange_unbind_without_key_with_arguments.phpt
rename to amqp-2.1.1/tests/amqpexchange_unbind_without_key_with_arguments.phpt
index d7c7746..80b4909 100644
--- a/amqp-2.1.0/tests/amqpexchange_unbind_without_key_with_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_unbind_without_key_with_arguments.phpt
@@ -1,45 +1,45 @@
--TEST--
AMQPExchange::unbind without key with arguments
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-unbind-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Declare a new exchange
$ex2 = new AMQPExchange($ch);
$ex2->setName('exchange2-unbind-' . bin2hex(random_bytes(32)));
$ex2->setType(AMQP_EX_TYPE_FANOUT);
$ex2->declareExchange();
$time = microtime(true);
var_dump($ex->bind($ex2->getName(), null, array('test' => 'passed', 'at' => $time, 'i am' => 'first')));
var_dump($ex->unbind($ex2->getName(), null, array('test' => 'passed', 'at' => $time, 'i am' => 'first')));
var_dump($ex->unbind($ex2->getName(), null, array('test' => 'passed', 'at' => $time, 'i am' => 'first')));
var_dump($ex->bind($ex2->getName(), '', array('test' => 'passed', 'at' => $time, 'i am' => 'second')));
var_dump($ex->unbind($ex2->getName(), '', array('test' => 'passed', 'at' => $time, 'i am' => 'second')));
var_dump($ex->unbind($ex2->getName(), '', array('test' => 'passed', 'at' => $time, 'i am' => 'second')));
?>
--EXPECT--
NULL
NULL
NULL
NULL
NULL
NULL
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpexchange_var_dump.phpt b/amqp-2.1.1/tests/amqpexchange_var_dump.phpt
similarity index 89%
rename from amqp-2.1.0/tests/amqpexchange_var_dump.phpt
rename to amqp-2.1.1/tests/amqpexchange_var_dump.phpt
index 939816d..0ed72df 100644
--- a/amqp-2.1.0/tests/amqpexchange_var_dump.phpt
+++ b/amqp-2.1.1/tests/amqpexchange_var_dump.phpt
@@ -1,66 +1,66 @@
--TEST--
AMQPExchange var_dump
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
var_dump($ex);
$ex->setArguments(array("x-ha-policy" => "all"));
var_dump($ex);
?>
--EXPECTF--
object(AMQPExchange)#3 (9) {
["connection":"AMQPExchange":private]=>
%a
["channel":"AMQPExchange":private]=>
%a
["name":"AMQPExchange":private]=>
string(%d) "exchange-%s"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["autoDelete":"AMQPExchange":private]=>
bool(false)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(0) {
}
}
object(AMQPExchange)#3 (9) {
["connection":"AMQPExchange":private]=>
%a
["channel":"AMQPExchange":private]=>
%a
["name":"AMQPExchange":private]=>
string(%d) "exchange-%s"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["autoDelete":"AMQPExchange":private]=>
bool(false)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(1) {
["x-ha-policy"]=>
string(3) "all"
}
}
diff --git a/amqp-2.1.0/tests/amqpqueue-cancel-no-consumers.phpt b/amqp-2.1.1/tests/amqpqueue-cancel-no-consumers.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpqueue-cancel-no-consumers.phpt
rename to amqp-2.1.1/tests/amqpqueue-cancel-no-consumers.phpt
index 0d68672..cc2cd44 100644
--- a/amqp-2.1.0/tests/amqpqueue-cancel-no-consumers.phpt
+++ b/amqp-2.1.1/tests/amqpqueue-cancel-no-consumers.phpt
@@ -1,47 +1,47 @@
--TEST--
AMQPQueue - orphaned envelope
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
///** @var \Enqueue\AmqpExt\AmqpContext context */
//$context = $this->createContext();
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$extChannel = new AMQPChannel($cnn);
$extChannel->qos(0, 3);
$microtime = microtime('true');
$queue_name = 'queue-test-.' . $microtime;
$exchange_name = 'exchnage-test-.' . $microtime;
$queue_1 = new \AMQPQueue($extChannel);
$queue_1->setName($queue_name);
$queue_1->declareQueue();
var_dump($queue_1->purge());
$exchange = new \AMQPExchange($extChannel);
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$exchange->setName($exchange_name);
$exchange->declareExchange();
$exchange->publish( 'test message', $queue_name, AMQP_NOPARAM, []);
$queue_2 = new \AMQPQueue($extChannel);
$queue_2->setName($queue_name);
$queue_2->consume(null, AMQP_NOPARAM, '');
$consumer_tag = $queue_2->getConsumerTag();
$queue_1->cancel($consumer_tag);
echo "Canceled", PHP_EOL;
--EXPECTF--
int(0)
Canceled
diff --git a/amqp-2.1.0/tests/amqpqueue_attributes.phpt b/amqp-2.1.1/tests/amqpqueue_attributes.phpt
similarity index 85%
rename from amqp-2.1.0/tests/amqpqueue_attributes.phpt
rename to amqp-2.1.1/tests/amqpqueue_attributes.phpt
index fe8996d..0b4864b 100644
--- a/amqp-2.1.0/tests/amqpqueue_attributes.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_attributes.phpt
@@ -1,44 +1,44 @@
--TEST--
AMQPQueue attributes
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$q = new AMQPQueue($ch);
var_dump($q->setArguments($arr = array('existent' => 'value', 'false' => false)));
echo 'Initial args: ', count($arr), ', queue args: ', count($q->getArguments()), PHP_EOL;
var_dump($q->setArgument('foo', 'bar'));
echo 'Initial args: ', count($arr), ', queue args: ', count($q->getArguments()), PHP_EOL;
foreach (array('existent', 'false', 'nonexistent') as $key) {
echo "$key: ";
var_export($q->hasArgument($key));
echo ', ';
try {
var_export($q->getArgument($key));
} catch (AMQPQueueException $e) {
echo 'Ex: ', $e->getMessage();
}
echo PHP_EOL;
}
?>
--EXPECT--
NULL
Initial args: 2, queue args: 2
NULL
Initial args: 2, queue args: 3
existent: true, 'value'
false: true, false
nonexistent: false, Ex: The argument "nonexistent" does not exist
diff --git a/amqp-2.1.0/tests/amqpqueue_bind_basic.phpt b/amqp-2.1.1/tests/amqpqueue_bind_basic.phpt
similarity index 75%
rename from amqp-2.1.0/tests/amqpqueue_bind_basic.phpt
rename to amqp-2.1.1/tests/amqpqueue_bind_basic.phpt
index d45f27c..6234d78 100644
--- a/amqp-2.1.0/tests/amqpqueue_bind_basic.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_bind_basic.phpt
@@ -1,30 +1,30 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
$queue->declareQueue();
var_dump($queue->bind($ex->getName(), 'routing.key'));
$queue->delete();
$ex->delete();
?>
--EXPECT--
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_bind_basic_empty_routing_key.phpt b/amqp-2.1.1/tests/amqpqueue_bind_basic_empty_routing_key.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpqueue_bind_basic_empty_routing_key.phpt
rename to amqp-2.1.1/tests/amqpqueue_bind_basic_empty_routing_key.phpt
index ea9d641..0c9d284 100644
--- a/amqp-2.1.0/tests/amqpqueue_bind_basic_empty_routing_key.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_bind_basic_empty_routing_key.phpt
@@ -1,34 +1,34 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
var_dump($ex->declareExchange());
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
var_dump($queue->declareQueue());
var_dump($queue->bind($ex->getName()));
var_dump($queue->delete());
var_dump($ex->delete());
?>
--EXPECT--
NULL
int(0)
NULL
int(0)
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_bind_basic_headers_arguments.phpt b/amqp-2.1.1/tests/amqpqueue_bind_basic_headers_arguments.phpt
similarity index 79%
rename from amqp-2.1.0/tests/amqpqueue_bind_basic_headers_arguments.phpt
rename to amqp-2.1.1/tests/amqpqueue_bind_basic_headers_arguments.phpt
index 6325afe..4953d11 100644
--- a/amqp-2.1.0/tests/amqpqueue_bind_basic_headers_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_bind_basic_headers_arguments.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_HEADERS);
var_dump($ex->declareExchange());
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
var_dump($queue->declareQueue());
$arguments = array('x-match' => 'all', 'type' => 'custom');
var_dump($queue->bind($ex->getName(), '', $arguments));
var_dump($queue->delete());
var_dump($ex->delete());
?>
--EXPECT--
NULL
int(0)
NULL
int(0)
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_bind_null_routing_key.phpt b/amqp-2.1.1/tests/amqpqueue_bind_null_routing_key.phpt
similarity index 80%
rename from amqp-2.1.0/tests/amqpqueue_bind_null_routing_key.phpt
rename to amqp-2.1.1/tests/amqpqueue_bind_null_routing_key.phpt
index bec8328..47b2a60 100644
--- a/amqp-2.1.0/tests/amqpqueue_bind_null_routing_key.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_bind_null_routing_key.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPQueue bind/unbind with explicit null routing key
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
var_dump($ex->declareExchange());
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
var_dump($queue->declareQueue());
var_dump($queue->bind($ex->getName(), null));
var_dump($queue->unbind($ex->getName(), null));
var_dump($queue->delete());
var_dump($ex->delete());
?>
--EXPECT--
NULL
int(0)
NULL
NULL
int(0)
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_cancel.phpt b/amqp-2.1.1/tests/amqpqueue_cancel.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpqueue_cancel.phpt
rename to amqp-2.1.1/tests/amqpqueue_cancel.phpt
index 2e2b6e4..8646c53 100644
--- a/amqp-2.1.0/tests/amqpqueue_cancel.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_cancel.phpt
@@ -1,148 +1,149 @@
--TEST--
AMQPQueue cancel
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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";
+elseif (getenv("SKIP_SLOW_TESTS")) print "skip slow test and SKIP_SLOW_TESTS is set";
?>
--FILE--
<?php
function create_connection() {
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
return $cnn;
}
function create_channel($cnn) {
$channel = new AMQPChannel($cnn);
$channel->setPrefetchCount(1);
return $channel;
}
function create_exchange($channel) {
$exchange = new AMQPExchange($channel);
$exchange->setName('test_cancel_exchange');
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$exchange->declareExchange();
return $exchange;
}
function create_queue($channel) {
$queue = new AMQPQueue($channel);
$queue->setName('test_cancel_queue');
$queue->setFlags(AMQP_NOPARAM);
$queue->declareQueue();
$queue->bind('test_cancel_exchange', 'test_cancel_routing_key');
return $queue;
}
class TrivialAcceptor {
private $count = 0;
private $maxCount;
public function __construct($maxCount) {
$this->maxCount = $maxCount;
}
public function accept($envelope, $queue) {
var_dump(
$envelope->getBody(),
$envelope->getDeliveryTag(),
$envelope->isRedelivery()
);
echo "\n";
$queue->ack($envelope->getDeliveryTag());
$this->count++;
return $this->count < $this->maxCount;
}
}
function get_acceptor($count) {
$acceptorObject = new TrivialAcceptor($count);
return array($acceptorObject, 'accept');
}
function send_message($exchange, $message) {
$exchange->publish($message, 'test_cancel_routing_key');
}
function wait_for_messages($queue, $consumer_tag, $message_count, $cancel_afterwards) {
$consumeMethod = new ReflectionMethod('AMQPQueue', 'consume');
switch ($consumeMethod->getNumberOfParameters())
{
case 3:
$queue->consume(get_acceptor($message_count), AMQP_NOPARAM, $consumer_tag);
if ($cancel_afterwards)
$queue->cancel($consumer_tag);
break;
case 2:
$queue->consume(get_acceptor($message_count), AMQP_NOPARAM);
if ($cancel_afterwards)
$queue->cancel();
break;
default:
echo "AMQP::consume() takes neither 2 nor 3 parameters";
exit(1);
}
}
$consumer_tag_prefix = uniqid();
$send_conn = create_connection();
$send_chan = create_channel($send_conn);
$exchange = create_exchange($send_chan);
$recv_conn_1 = create_connection();
$recv_chan_1 = create_channel($recv_conn_1);
$queue_1 = create_queue($recv_chan_1);
send_message($exchange, 'message 0');
wait_for_messages($queue_1, $consumer_tag_prefix.'_1', 1, true);
send_message($exchange, 'message 1');
send_message($exchange, 'message 2');
$recv_chan_2 = create_channel($recv_conn_1);
$queue_2 = create_queue($recv_chan_2);
wait_for_messages($queue_2, $consumer_tag_prefix.'_2', 2, false);
$recv_conn_1->disconnect();
sleep(1);
$recv_conn_2 = create_connection();
$recv_chan_3 = create_channel($recv_conn_2);
$queue_3 = create_queue($recv_chan_3);
send_message($exchange, 'message 3');
send_message($exchange, 'message 4');
wait_for_messages($queue_3, $consumer_tag_prefix.'_3', 2, false);
$queue_3->delete(AMQP_NOPARAM);
$exchange->delete();
?>
--EXPECT--
string(9) "message 0"
int(1)
bool(false)
string(9) "message 1"
int(1)
bool(false)
string(9) "message 2"
int(2)
bool(false)
string(9) "message 3"
int(1)
bool(false)
string(9) "message 4"
int(2)
bool(false)
diff --git a/amqp-2.1.0/tests/amqpqueue_construct_basic.phpt b/amqp-2.1.1/tests/amqpqueue_construct_basic.phpt
similarity index 60%
rename from amqp-2.1.0/tests/amqpqueue_construct_basic.phpt
rename to amqp-2.1.1/tests/amqpqueue_construct_basic.phpt
index fb263ba..cfaeca2 100644
--- a/amqp-2.1.0/tests/amqpqueue_construct_basic.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_construct_basic.phpt
@@ -1,20 +1,20 @@
--TEST--
AMQPQueue constructor
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$queue = new AMQPQueue($ch);
echo get_class($queue);
?>
--EXPECT--
AMQPQueue
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpqueue_consume_basic.phpt b/amqp-2.1.1/tests/amqpqueue_consume_basic.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpqueue_consume_basic.phpt
rename to amqp-2.1.1/tests/amqpqueue_consume_basic.phpt
index 0c7ae1a..fd140c3 100644
--- a/amqp-2.1.0/tests/amqpqueue_consume_basic.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_consume_basic.phpt
@@ -1,147 +1,147 @@
--TEST--
AMQPQueue::consume basic
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
$ex->publish('message1', 'routing.1', AMQP_NOPARAM, array('content_type' => 'plain/test', 'headers' => array('foo' => 'bar')));
$ex->publish('message2', 'routing.2', AMQP_NOPARAM, array('delivery_mode' => AMQP_DELIVERY_MODE_PERSISTENT));
$ex->publish('message3', 'routing.3', AMQP_DURABLE); // this is wrong way to make messages persistent
$count = 0;
function consumeThingsTwoTimes($message, $queue) {
global $count;
echo "call #$count", PHP_EOL;
// Read from the queue
dump_message($message);
echo PHP_EOL;
$count++;
if ($count >= 2) {
return false;
}
return true;
}
// Read from the queue
$q->consume("consumeThingsTwoTimes", AMQP_AUTOACK);
$q->delete();
$ex->delete();
?>
--EXPECTF--
call #0
AMQPEnvelope
getBody:
string(8) "message1"
getContentType:
string(10) "plain/test"
getRoutingKey:
string(9) "routing.1"
getConsumerTag:
string(31) "amq.ctag-%s"
getDeliveryTag:
int(1)
getDeliveryMode:
int(1)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
NULL
getType:
NULL
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
NULL
getUserId:
NULL
getAppId:
NULL
getMessageId:
NULL
getReplyTo:
NULL
getCorrelationId:
NULL
getHeaders:
array(1) {
["foo"]=>
string(3) "bar"
}
call #1
AMQPEnvelope
getBody:
string(8) "message2"
getContentType:
string(10) "text/plain"
getRoutingKey:
string(9) "routing.2"
getConsumerTag:
string(31) "amq.ctag-%s"
getDeliveryTag:
int(2)
getDeliveryMode:
int(2)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
NULL
getType:
NULL
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
NULL
getUserId:
NULL
getAppId:
NULL
getMessageId:
NULL
getReplyTo:
NULL
getCorrelationId:
NULL
getHeaders:
array(0) {
}
diff --git a/amqp-2.1.0/tests/amqpqueue_consume_multiple.phpt b/amqp-2.1.1/tests/amqpqueue_consume_multiple.phpt
similarity index 92%
rename from amqp-2.1.0/tests/amqpqueue_consume_multiple.phpt
rename to amqp-2.1.1/tests/amqpqueue_consume_multiple.phpt
index 233e683..c8649ba 100644
--- a/amqp-2.1.0/tests/amqpqueue_consume_multiple.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_consume_multiple.phpt
@@ -1,85 +1,85 @@
--TEST--
AMQPQueue::consume multiple
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$id = bin2hex(random_bytes(32));
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ch2 = new AMQPChannel($cnn);
$ch3 = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . $id);
$ex->setType(AMQP_EX_TYPE_TOPIC);
$ex->declareExchange();
// Create and bind queues
$q1 = new AMQPQueue($ch);
$q1->setName('queue-one-' . $id);
$q1->declareQueue();
$q1->bind($ex->getName(), 'routing.one');
$q2 = new AMQPQueue($ch2);
$q2->setName('queue-two-' . $id);
$q2->declareQueue();
$q2->bind($ex->getName(), 'routing.two');
$q3 = new AMQPQueue($ch3);
$q3->setName('queue-three-' . $id);
$q3->declareQueue();
$q3->bind($ex->getName(), 'routing.three');
// Publish a message to the exchange with a routing key
$ex->publish('message1', 'routing.one');
$ex->publish('message2', 'routing.two');
$ex->publish('message3', 'routing.three');
$count = 0;
function consumeThings(AMQPEnvelope $message, AMQPQueue $queue)
{
global $count;
echo "Message: {$message->getBody()}, routing key: {$message->getRoutingKey()}, consumer tag: {$message->getConsumerTag()}\n";
echo "Queue: {$queue->getName()}, consumer tag: {$queue->getConsumerTag()}\n";
echo "Queue and message consumer tag ", ($queue->getConsumerTag() == $message->getConsumerTag() ? 'matches' : 'do not match'), "\n";
echo PHP_EOL;
$count++;
$queue->ack($message->getDeliveryTag());
if ($count >= 2) {
return false;
}
return true;
}
$q1->consume();
$q2->consume('consumeThings');
// This is important!
$q1->cancel();
$q2->cancel();
?>
--EXPECTF--
Message: message1, routing key: routing.one, consumer tag: amq.ctag-%s
Queue: queue-one-%s, consumer tag: amq.ctag-%s
Queue and message consumer tag matches
Message: message2, routing key: routing.two, consumer tag: amq.ctag-%s
Queue: queue-two-%s, consumer tag: amq.ctag-%s
Queue and message consumer tag matches
diff --git a/amqp-2.1.0/tests/amqpqueue_consume_multiple_no_doubles.phpt b/amqp-2.1.1/tests/amqpqueue_consume_multiple_no_doubles.phpt
similarity index 79%
rename from amqp-2.1.0/tests/amqpqueue_consume_multiple_no_doubles.phpt
rename to amqp-2.1.1/tests/amqpqueue_consume_multiple_no_doubles.phpt
index a2ad95e..a753976 100644
--- a/amqp-2.1.0/tests/amqpqueue_consume_multiple_no_doubles.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_consume_multiple_no_doubles.phpt
@@ -1,37 +1,37 @@
--TEST--
AMQPQueue::consume multiple (no doubles)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$time = microtime(true);
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
var_dump($q->getConsumerTag());
$q->consume();
var_dump($tag1=$q->getConsumerTag());
$q->consume(null, AMQP_JUST_CONSUME);
var_dump($tag2=$q->getConsumerTag());
echo ($tag1 == $tag2 ? 'equals' : 'differs'), PHP_EOL;
?>
--EXPECTF--
NULL
string(%d) "amq.ctag-%s"
string(%d) "amq.ctag-%s"
equals
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpqueue_consume_nonexistent.phpt b/amqp-2.1.1/tests/amqpqueue_consume_nonexistent.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpqueue_consume_nonexistent.phpt
rename to amqp-2.1.1/tests/amqpqueue_consume_nonexistent.phpt
index cc60181..2e49a7a 100644
--- a/amqp-2.1.0/tests/amqpqueue_consume_nonexistent.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_consume_nonexistent.phpt
@@ -1,38 +1,38 @@
--TEST--
AMQPQueue::consume from nonexistent queue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
function noop () {return false;}
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->setReadTimeout(10); // both are empirical values that should be far enough to deal with busy RabbitMQ broker
$cnn->setWriteTimeout(10);
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('nonexistent-' . bin2hex(random_bytes(32)));
try {
$q->consume('noop');
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage();
}
?>
--EXPECTF--
AMQPQueueException(404): Server channel error: 404, message: NOT_FOUND - no queue 'nonexistent-%s' in vhost '/'
diff --git a/amqp-2.1.0/tests/amqpqueue_consume_null_consumer_key.phpt b/amqp-2.1.1/tests/amqpqueue_consume_null_consumer_key.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpqueue_consume_null_consumer_key.phpt
rename to amqp-2.1.1/tests/amqpqueue_consume_null_consumer_key.phpt
index eb2a1e1..bde2171 100644
--- a/amqp-2.1.0/tests/amqpqueue_consume_null_consumer_key.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_consume_null_consumer_key.phpt
@@ -1,50 +1,50 @@
--TEST--
AMQPQueue::consume basic
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName());
// Publish a message to the exchange with a routing key
$ex->publish('message1');
$count = 0;
function consume($message, $queue) {
global $count;
var_dump($count++);
return false;
}
$q->consume(null, AMQP_AUTOACK, null);
$q->delete();
$ex->delete();
?>
==DONE==
--EXPECTF--
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/amqpqueue_consume_timeout.phpt b/amqp-2.1.1/tests/amqpqueue_consume_timeout.phpt
similarity index 85%
rename from amqp-2.1.0/tests/amqpqueue_consume_timeout.phpt
rename to amqp-2.1.1/tests/amqpqueue_consume_timeout.phpt
index dcba12f..b1fdb91 100644
--- a/amqp-2.1.0/tests/amqpqueue_consume_timeout.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_consume_timeout.phpt
@@ -1,46 +1,46 @@
--TEST--
AMQPQueue::consume with timeout
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
function nop() {
}
$timeout = .68;
$cnn = new AMQPConnection(array('read_timeout' => $timeout));
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$chan = new AMQPChannel($cnn);
$queue = new AMQPQueue($chan);
$queue->setFlags(AMQP_EXCLUSIVE);
$queue->declareQueue();
$start = microtime(true);
try {
$queue->consume('nop');
} catch (AMQPException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage();
echo PHP_EOL;
}
$end = microtime(true);
$error = $end - $start - $timeout;
$limit = abs(log10($timeout)); // empirical value
echo 'timeout: ', $timeout, PHP_EOL;
echo 'takes: ', $end - $start, PHP_EOL;
echo 'error: ', $error, PHP_EOL;
echo 'limit: ', $limit, PHP_EOL;
echo abs($error) <= $limit ? 'timings OK' : 'timings failed'; // error should be less than 5% of timeout value
$queue->delete();
?>
--EXPECTF--
AMQPQueueException(0): Consumer timeout exceed
timeout: %f
takes: %f
error: %f
limit: %f
timings OK
diff --git a/amqp-2.1.0/tests/amqpqueue_declare_basic.phpt b/amqp-2.1.1/tests/amqpqueue_declare_basic.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpqueue_declare_basic.phpt
rename to amqp-2.1.1/tests/amqpqueue_declare_basic.phpt
index 1e4b559..7df6cf2 100644
--- a/amqp-2.1.0/tests/amqpqueue_declare_basic.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_declare_basic.phpt
@@ -1,33 +1,33 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
var_dump($queue->setName("queue-" . bin2hex(random_bytes(32))));
var_dump($queue->declareQueue());
var_dump($queue->bind($ex->getName(), 'routing.key'));
var_dump($queue->delete());
var_dump($ex->delete());
?>
--EXPECT--
NULL
int(0)
NULL
int(0)
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_declare_with_arguments.phpt b/amqp-2.1.1/tests/amqpqueue_declare_with_arguments.phpt
similarity index 82%
rename from amqp-2.1.0/tests/amqpqueue_declare_with_arguments.phpt
rename to amqp-2.1.1/tests/amqpqueue_declare_with_arguments.phpt
index 0456e37..c9052a0 100644
--- a/amqp-2.1.0/tests/amqpqueue_declare_with_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_declare_with_arguments.phpt
@@ -1,37 +1,37 @@
--TEST--
AMQPQueue::declareQueue() - with arguments
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
var_dump($queue->setName("queue-" . bin2hex(random_bytes(32))));
var_dump($queue->setArgument('x-dead-letter-exchange', ''));
var_dump($queue->setArgument('x-dead-letter-routing-key', 'some key'));
var_dump($queue->setArgument('x-message-ttl', 42));
var_dump($queue->setFlags(AMQP_AUTODELETE));
var_dump($queue->declareQueue());
var_dump($queue->delete());
?>
--EXPECT--
NULL
NULL
NULL
NULL
NULL
int(0)
int(0)
diff --git a/amqp-2.1.0/tests/amqpqueue_declare_with_stalled_reference.phpt b/amqp-2.1.1/tests/amqpqueue_declare_with_stalled_reference.phpt
similarity index 91%
rename from amqp-2.1.0/tests/amqpqueue_declare_with_stalled_reference.phpt
rename to amqp-2.1.1/tests/amqpqueue_declare_with_stalled_reference.phpt
index 3e67a46..f10ab3a 100644
--- a/amqp-2.1.0/tests/amqpqueue_declare_with_stalled_reference.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_declare_with_stalled_reference.phpt
@@ -1,42 +1,42 @@
--TEST--
AMQPQueue - declare with stalled reference
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
class ConnectionMock extends AMQPConnection {
public function __construct(array $credentials = array())
{
}
}
class ChannelMock extends AMQPChannel {
public function __construct(AMQPConnection $amqp_connection)
{
}
}
class QueueMock extends \AMQPQueue
{
public function __construct(AMQPChannel $amqp_channel)
{
}
}
$cnn = new ConnectionMock();
$ch = new ChannelMock($cnn);
$e = new QueueMock($ch);
try {
$e->declareQueue();
} catch (\Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
AMQPChannelException(0): Could not declare queue. Stale reference to the channel object.
diff --git a/amqp-2.1.0/tests/amqpqueue_delete_basic.phpt b/amqp-2.1.1/tests/amqpqueue_delete_basic.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpqueue_delete_basic.phpt
rename to amqp-2.1.1/tests/amqpqueue_delete_basic.phpt
index 973ce58..04ae0b3 100644
--- a/amqp-2.1.0/tests/amqpqueue_delete_basic.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_delete_basic.phpt
@@ -1,49 +1,49 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
$queue->declareQueue();
$queue->bind($ex->getName());
var_dump($queue->delete());
var_dump($queue->delete(null));
$queue->declareQueue();
$queue->bind($ex->getName());
$ex->publish('test 1');
$ex->publish('test 2');
$ex->publish('test 3');
var_dump($queue->delete());
$ex->publish('test 1');
$ex->publish('test 2');
$ex->publish('test 3');
var_dump($queue->delete());
$ex->delete();
?>
--EXPECT--
int(0)
int(0)
int(3)
int(0)
diff --git a/amqp-2.1.0/tests/amqpqueue_empty_name.phpt b/amqp-2.1.1/tests/amqpqueue_empty_name.phpt
similarity index 75%
rename from amqp-2.1.0/tests/amqpqueue_empty_name.phpt
rename to amqp-2.1.1/tests/amqpqueue_empty_name.phpt
index 4554b65..d19dcf2 100644
--- a/amqp-2.1.0/tests/amqpqueue_empty_name.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_empty_name.phpt
@@ -1,28 +1,28 @@
--TEST--
AMQPQueue declared with empty name
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
$queue->declareQueue();
var_dump(substr($queue->getName(), 0, strlen('amq.gen-')));
$queue->delete();
$ex->delete();
?>
--EXPECT--
string(8) "amq.gen-"
diff --git a/amqp-2.1.0/tests/amqpqueue_get_basic.phpt b/amqp-2.1.1/tests/amqpqueue_get_basic.phpt
similarity index 95%
rename from amqp-2.1.0/tests/amqpqueue_get_basic.phpt
rename to amqp-2.1.1/tests/amqpqueue_get_basic.phpt
index fd160f6..4b80c9f 100644
--- a/amqp-2.1.0/tests/amqpqueue_get_basic.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_get_basic.phpt
@@ -1,175 +1,175 @@
--TEST--
AMQPQueue::get basic
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-'. bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
$ex->publish('message1', 'routing.1', AMQP_NOPARAM, array('content_type' => 'plain/test', 'headers' => array('foo' => 'bar')));
$ex->publish('message2', 'routing.2', AMQP_DURABLE);
$ex->publish('message3', 'routing.3');
for ($i = 0; $i < 4; $i++) {
echo "call #$i", PHP_EOL;
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
dump_message($msg);
echo PHP_EOL;
}
?>
--EXPECTF--
call #0
AMQPEnvelope
getBody:
string(8) "message1"
getContentType:
string(10) "plain/test"
getRoutingKey:
string(9) "routing.1"
getConsumerTag:
string(0) ""
getDeliveryTag:
int(1)
getDeliveryMode:
int(1)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
NULL
getType:
NULL
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
NULL
getUserId:
NULL
getAppId:
NULL
getMessageId:
NULL
getReplyTo:
NULL
getCorrelationId:
NULL
getHeaders:
array(1) {
["foo"]=>
string(3) "bar"
}
call #1
AMQPEnvelope
getBody:
string(8) "message2"
getContentType:
string(10) "text/plain"
getRoutingKey:
string(9) "routing.2"
getConsumerTag:
string(0) ""
getDeliveryTag:
int(2)
getDeliveryMode:
int(1)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
NULL
getType:
NULL
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
NULL
getUserId:
NULL
getAppId:
NULL
getMessageId:
NULL
getReplyTo:
NULL
getCorrelationId:
NULL
getHeaders:
array(0) {
}
call #2
AMQPEnvelope
getBody:
string(8) "message3"
getContentType:
string(10) "text/plain"
getRoutingKey:
string(9) "routing.3"
getConsumerTag:
string(0) ""
getDeliveryTag:
int(3)
getDeliveryMode:
int(1)
getExchangeName:
string(%d) "exchange-%s"
isRedelivery:
bool(false)
getContentEncoding:
NULL
getType:
NULL
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
NULL
getUserId:
NULL
getAppId:
NULL
getMessageId:
NULL
getReplyTo:
NULL
getCorrelationId:
NULL
getHeaders:
array(0) {
}
call #3
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_get_channel.phpt b/amqp-2.1.1/tests/amqpqueue_get_channel.phpt
similarity index 78%
rename from amqp-2.1.0/tests/amqpqueue_get_channel.phpt
rename to amqp-2.1.1/tests/amqpqueue_get_channel.phpt
index 4e50c29..c125083 100644
--- a/amqp-2.1.0/tests/amqpqueue_get_channel.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_get_channel.phpt
@@ -1,33 +1,33 @@
--TEST--
AMQPQueue getChannel() test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$ch2 = new AMQPChannel($cnn);
$q = new AMQPQueue($ch);
echo $ch === $q->getChannel() ? 'same' : 'not same', PHP_EOL;
echo $ch2 === $q->getChannel() ? 'same' : 'not same', PHP_EOL;
$old_prefetch = $ch->getPrefetchCount();
$new_prefetch = 999;
$q->getChannel()->setPrefetchCount($new_prefetch);
echo $ch->getPrefetchCount() == $new_prefetch ? 'by ref' : 'copy', PHP_EOL;
?>
--EXPECT--
same
not same
by ref
diff --git a/amqp-2.1.0/tests/amqpqueue_get_connection.phpt b/amqp-2.1.1/tests/amqpqueue_get_connection.phpt
similarity index 77%
rename from amqp-2.1.0/tests/amqpqueue_get_connection.phpt
rename to amqp-2.1.1/tests/amqpqueue_get_connection.phpt
index 2591197..8819061 100644
--- a/amqp-2.1.0/tests/amqpqueue_get_connection.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_get_connection.phpt
@@ -1,35 +1,35 @@
--TEST--
AMQPQueue getConnection test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$q = new AMQPQueue($ch);
$cnn2 = new AMQPConnection();
echo $cnn === $q->getConnection() ? 'same' : 'not same', PHP_EOL;
echo $cnn2 === $q->getConnection() ? 'same' : 'not same', PHP_EOL;
$old_host = $cnn->getHost();
$new_host = 'test';
$q->getConnection()->setHost($new_host);
echo $cnn->getHost() == $new_host ? 'by ref' : 'copy', PHP_EOL;
?>
--EXPECT--
same
not same
by ref
diff --git a/amqp-2.1.0/tests/amqpqueue_get_empty_body.phpt b/amqp-2.1.1/tests/amqpqueue_get_empty_body.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpqueue_get_empty_body.phpt
rename to amqp-2.1.1/tests/amqpqueue_get_empty_body.phpt
index 6d4757c..9220c15 100644
--- a/amqp-2.1.0/tests/amqpqueue_get_empty_body.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_get_empty_body.phpt
@@ -1,48 +1,48 @@
--TEST--
AMQPQueue::get empty body
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
$ex->publish('', 'routing.1');
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
echo "'" . $msg->getBody() . "'\n";
$msg = $q->get(AMQP_AUTOACK);
if ($msg === null) {
echo "No more messages\n";
}
$ex->delete();
$q->delete();
?>
--EXPECT--
''
No more messages
diff --git a/amqp-2.1.0/tests/amqpqueue_get_headers.phpt b/amqp-2.1.1/tests/amqpqueue_get_headers.phpt
similarity index 89%
rename from amqp-2.1.0/tests/amqpqueue_get_headers.phpt
rename to amqp-2.1.1/tests/amqpqueue_get_headers.phpt
index f6c9971..a72a68b 100644
--- a/amqp-2.1.0/tests/amqpqueue_get_headers.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_get_headers.phpt
@@ -1,66 +1,66 @@
--TEST--
AMQPQueue::get headers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . bin2hex(random_bytes(32)));
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
$ex->publish('body', 'routing.1', AMQP_NOPARAM, array("headers" => array(
"first" => "one",
"second" => 2
)));
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
echo $msg->getBody() . "\n";
var_dump($msg->getHeaders());
echo $msg->getContentType() . "\n";
var_dump($msg->hasHeader("first"));
echo $msg->getHeader("first") . "\n";
echo $msg->getHeader("second") . "\n";
echo 'Has nonexistent header: ', var_export($msg->hasHeader("nonexistent"), true), PHP_EOL;
echo 'Get nonexistent header: ', var_export($msg->getHeader("nonexistent"), true), PHP_EOL;
$ex->delete();
$q->delete();
?>
--EXPECT--
body
array(2) {
["first"]=>
string(3) "one"
["second"]=>
int(2)
}
text/plain
bool(true)
one
2
Has nonexistent header: false
Get nonexistent header: NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_get_nonexistent.phpt b/amqp-2.1.1/tests/amqpqueue_get_nonexistent.phpt
similarity index 83%
rename from amqp-2.1.0/tests/amqpqueue_get_nonexistent.phpt
rename to amqp-2.1.1/tests/amqpqueue_get_nonexistent.phpt
index 4bd7ea5..f28d44a 100644
--- a/amqp-2.1.0/tests/amqpqueue_get_nonexistent.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_get_nonexistent.phpt
@@ -1,36 +1,36 @@
--TEST--
AMQPQueue::get from nonexistent queue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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->setReadTimeout(10); // both are empirical values that should be far enough to deal with busy RabbitMQ broker
$cnn->setWriteTimeout(10);
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('nonexistent-' . bin2hex(random_bytes(32)));
try {
$q->get();
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage();
}
?>
--EXPECTF--
AMQPQueueException(404): Server channel error: 404, message: NOT_FOUND - no queue 'nonexistent-%s' in vhost '/'
diff --git a/amqp-2.1.0/tests/amqpqueue_headers_with_bool.phpt b/amqp-2.1.1/tests/amqpqueue_headers_with_bool.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpqueue_headers_with_bool.phpt
rename to amqp-2.1.1/tests/amqpqueue_headers_with_bool.phpt
index e1feeb8..c8b9659 100644
--- a/amqp-2.1.0/tests/amqpqueue_headers_with_bool.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_headers_with_bool.phpt
@@ -1,61 +1,61 @@
--TEST--
AMQPQueue::get headers with bool values
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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',
'true' => true,
'false' => false,
)
)
);
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
var_dump($msg->getHeaders());
echo $msg->getHeader('foo') . "\n";
var_dump($msg->hasHeader('true'), $msg->getHeader('true'));
var_dump($msg->hasHeader('false'), $msg->getHeader('false'));
$ex->delete();
$q->delete();
?>
--EXPECT--
array(3) {
["foo"]=>
string(3) "bar"
["true"]=>
bool(true)
["false"]=>
bool(false)
}
bar
bool(true)
bool(true)
bool(true)
bool(false)
diff --git a/amqp-2.1.0/tests/amqpqueue_headers_with_float.phpt b/amqp-2.1.1/tests/amqpqueue_headers_with_float.phpt
similarity index 90%
rename from amqp-2.1.0/tests/amqpqueue_headers_with_float.phpt
rename to amqp-2.1.1/tests/amqpqueue_headers_with_float.phpt
index dc0fc4c..35ecc22 100644
--- a/amqp-2.1.0/tests/amqpqueue_headers_with_float.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_headers_with_float.phpt
@@ -1,73 +1,73 @@
--TEST--
AMQPQueue::get headers with float values
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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',
'positive' => 2.3,
'negative' => -1022.123456789,
'scientific' => 10E2,
'scientific_big' => 10E23,
)
)
);
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
var_dump($msg->getHeaders());
echo $msg->getHeader('foo') . "\n";
var_dump($msg->hasHeader('positive'), $msg->getHeader('positive'));
var_dump($msg->hasHeader('negative'), $msg->getHeader('negative'));
var_dump($msg->hasHeader('scientific'), $msg->getHeader('scientific'));
var_dump($msg->hasHeader('scientific_big'), $msg->getHeader('scientific_big'));
$ex->delete();
$q->delete();
?>
--EXPECT--
array(5) {
["foo"]=>
string(3) "bar"
["positive"]=>
float(2.3)
["negative"]=>
float(-1022.123456789)
["scientific"]=>
float(1000)
["scientific_big"]=>
float(1.0E+24)
}
bar
bool(true)
float(2.3)
bool(true)
float(-1022.123456789)
bool(true)
float(1000)
bool(true)
float(1.0E+24)
diff --git a/amqp-2.1.0/tests/amqpqueue_headers_with_null.phpt b/amqp-2.1.1/tests/amqpqueue_headers_with_null.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpqueue_headers_with_null.phpt
rename to amqp-2.1.1/tests/amqpqueue_headers_with_null.phpt
index c809cf3..dc45012 100644
--- a/amqp-2.1.0/tests/amqpqueue_headers_with_null.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_headers_with_null.phpt
@@ -1,54 +1,54 @@
--TEST--
AMQPQueue::get headers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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',
'null' => NULL
)
)
);
// Read from the queue
$msg = $q->get(AMQP_AUTOACK);
var_dump($msg->getHeaders());
echo $msg->getHeader('foo') . "\n";
var_dump($msg->getHeader('null'));
$ex->delete();
$q->delete();
?>
--EXPECT--
array(2) {
["foo"]=>
string(3) "bar"
["null"]=>
NULL
}
bar
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_nack.phpt b/amqp-2.1.1/tests/amqpqueue_nack.phpt
similarity index 88%
rename from amqp-2.1.0/tests/amqpqueue_nack.phpt
rename to amqp-2.1.1/tests/amqpqueue_nack.phpt
index 2c5a23d..b55e0e5 100644
--- a/amqp-2.1.0/tests/amqpqueue_nack.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_nack.phpt
@@ -1,59 +1,59 @@
--TEST--
AMQPQueue::nack
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
ini_set('amqp.auto_ack', false);
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('testnack' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
$exchangeName = $ex->getName();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('testnack' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($exchangeName, '#');
// Bind it on the exchange to routing.key
// Publish a message to the exchange with a routing key
$ex->publish('message', 'foo');
$env = $q->get(AMQP_NOPARAM);
echo $env->getBody() . PHP_EOL;
echo $env->isRedelivery() ? 'true' : 'false';
echo PHP_EOL;
// send the message back to the queue
$q->nack($env->getDeliveryTag(), AMQP_REQUEUE);
// read again
$env2 = $q->get(AMQP_NOPARAM);
if (false !== $env2) {
$q->ack($env2->getDeliveryTag(), null);
echo $env2->getBody() . PHP_EOL;
echo $env2->isRedelivery() ? 'true' : 'false';
echo PHP_EOL;
} else {
echo "could not read message" . PHP_EOL;
}
$ex->delete();
$q->delete();
--EXPECT--
message
false
message
true
diff --git a/amqp-2.1.0/tests/amqpqueue_nested_arrays.phpt b/amqp-2.1.1/tests/amqpqueue_nested_arrays.phpt
similarity index 86%
rename from amqp-2.1.0/tests/amqpqueue_nested_arrays.phpt
rename to amqp-2.1.1/tests/amqpqueue_nested_arrays.phpt
index d2cc4ff..390470c 100644
--- a/amqp-2.1.0/tests/amqpqueue_nested_arrays.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_nested_arrays.phpt
@@ -1,68 +1,68 @@
--TEST--
AMQPQueue::get headers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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"
}
diff --git a/amqp-2.1.0/tests/amqpqueue_nested_headers.phpt b/amqp-2.1.1/tests/amqpqueue_nested_headers.phpt
similarity index 94%
rename from amqp-2.1.0/tests/amqpqueue_nested_headers.phpt
rename to amqp-2.1.1/tests/amqpqueue_nested_headers.phpt
index cbceb99..8daf442 100644
--- a/amqp-2.1.0/tests/amqpqueue_nested_headers.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_nested_headers.phpt
@@ -1,132 +1,132 @@
--TEST--
AMQPQueue::get headers
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// create an error exchange and bind a queue to it:
$errorXchange = new AMQPExchange($ch);
$errorXchange->setName('errorXchange' . bin2hex(random_bytes(32)));
$errorXchange->setType(AMQP_EX_TYPE_TOPIC);
$errorXchange->declareExchange();
$errorQ = new AMQPQueue($ch);
$errorQ->setName('errorQueue' . bin2hex(random_bytes(32)));
$errorQ->declareQueue();
$errorQ->bind($errorXchange->getName(), '#');
// Declare a new exchange and queue using this dead-letter-exchange:
$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('queue-' . bin2hex(random_bytes(32)));
$q->setArgument('x-dead-letter-exchange', $errorXchange->getName());
$q->declareQueue();
$q->bind($ex->getName(), '#');
// publish a message:
$ex->publish(
'body', 'routing.1', AMQP_NOPARAM, array(
'headers' => array(
'foo' => 'fval',
'bar' => array(array('aa', 'bb', array('bar_nested' => 'nested'))),
'baz' => array('a', 'bc', 'def', 123, 'g'),
'bla' => array('one' => 2),
)
)
);
// Read from the queue and reject, so it gets dead-lettered:
$msg = $q->get(AMQP_NOPARAM);
$q->nack($msg->getDeliveryTag());
sleep(1);
// Now read from the error queue:
$msg = $errorQ->get(AMQP_AUTOACK);
$header = $msg->getHeader('x-death');
echo isset($header[0]['count']) ? 'count found' : 'count not found', PHP_EOL;
unset($header[0]['count']);
var_dump($header);
var_dump($msg->getHeader('foo'));
var_dump($msg->getHeader('bar'));
var_dump($msg->getHeader('baz'));
var_dump($msg->getHeader('bla'));
$ex->delete();
$q->delete();
$errorXchange->delete();
$errorQ->delete();
?>
==DONE==
--EXPECTF--
count %s
array(1) {
[0]=>
array(5) {
["reason"]=>
string(8) "rejected"
["queue"]=>
string(%d) "queue-%s"
["time"]=>
object(AMQPTimestamp)#%d (1) {
["timestamp":"AMQPTimestamp":private]=>
float(%d)
}
["exchange"]=>
string(%d) "exchange-%s"
["routing-keys"]=>
array(1) {
[0]=>
string(9) "routing.1"
}
}
}
string(4) "fval"
array(1) {
[0]=>
array(3) {
[0]=>
string(2) "aa"
[1]=>
string(2) "bb"
[2]=>
array(1) {
["bar_nested"]=>
string(6) "nested"
}
}
}
array(5) {
[0]=>
string(1) "a"
[1]=>
string(2) "bc"
[2]=>
string(3) "def"
[3]=>
int(123)
[4]=>
string(1) "g"
}
array(1) {
["one"]=>
int(2)
}
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.1/tests/amqpqueue_purge_basic.phpt b/amqp-2.1.1/tests/amqpqueue_purge_basic.phpt
new file mode 100644
index 0000000..df977d5
--- /dev/null
+++ b/amqp-2.1.1/tests/amqpqueue_purge_basic.phpt
@@ -0,0 +1,10 @@
+--TEST--
+AMQPQueue
+--SKIPIF--
+<?php
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+?>
+--FILE--
+<?php
+?>
+--EXPECT--
diff --git a/amqp-2.1.0/tests/amqpqueue_recover.phpt b/amqp-2.1.1/tests/amqpqueue_recover.phpt
similarity index 85%
rename from amqp-2.1.0/tests/amqpqueue_recover.phpt
rename to amqp-2.1.1/tests/amqpqueue_recover.phpt
index 10fd4c0..e5b5eaf 100644
--- a/amqp-2.1.0/tests/amqpqueue_recover.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_recover.phpt
@@ -1,56 +1,56 @@
--TEST--
AMQPQueue::nack
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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('testrecover-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
$exchangeName = $ex->getName();
$q = new AMQPQueue($ch);
$q->setName('testrecover-' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($exchangeName);
$ex->publish('message');
function inspectMessage(AMQPQueue $q) {
$msg = $q->get();
echo $msg->getBody(), PHP_EOL;
echo $msg->isRedelivery() ? 'true' : 'false';
echo PHP_EOL;
}
inspectMessage($q);
$q->recover();
inspectMessage($q);
$q->recover(true);
inspectMessage($q);
try {
$q->recover(false);
} catch (AMQPConnectionException $e) {
echo $e->getMessage(), PHP_EOL;
}
--EXPECT--
message
false
message
true
message
true
Server connection error: 540, message: NOT_IMPLEMENTED - requeue=false
diff --git a/amqp-2.1.0/tests/amqpqueue_setArgument.phpt b/amqp-2.1.1/tests/amqpqueue_setArgument.phpt
similarity index 96%
rename from amqp-2.1.0/tests/amqpqueue_setArgument.phpt
rename to amqp-2.1.1/tests/amqpqueue_setArgument.phpt
index 59df310..c668b8e 100644
--- a/amqp-2.1.0/tests/amqpqueue_setArgument.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_setArgument.phpt
@@ -1,183 +1,183 @@
--TEST--
AMQPQueue::setArgument() test
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
$credentials = array();
$cnn = new AMQPConnection($credentials);
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$ch = new AMQPChannel($cnn);
$heartbeat = 10;
$q_dead_name = 'test.queue.dead.' . bin2hex(random_bytes(32));
$q_name = 'test.queue.' . bin2hex(random_bytes(32));
$q = new AMQPQueue($ch);
$q->setName($q_name);
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
var_dump($q);
class MyValue implements AMQPValue {
public function toAmqpValue() { return "foo"; }
}
$q_dead = new AMQPQueue($ch);
$q_dead->setName($q_dead_name);
$q_dead->setArgument('x-dead-letter-exchange', '');
$q_dead->setArgument('x-dead-letter-routing-key', $q_name);
$q_dead->setArgument('x-message-ttl', $heartbeat * 10 * 1000);
$q_dead->setArgument('x-null', null);
$q_dead->setArgument('x-array', [0, 3]);
$q_dead->setArgument('x-hash', ['foo' => 'bar']);
$q_dead->setArgument('x-timestamp', new AMQPTimestamp(404));
$q_dead->setArgument('x-decimal', new AMQPDecimal(1, 2));
$q_dead->setArgument('x-custom-value', new MyValue());
$q_dead->setFlags(AMQP_AUTODELETE);
$q_dead->declareQueue();
var_dump($q_dead);
$q_dead->removeArgument('x-null');
$q_dead->removeArgument('x-does-not-exist');
var_dump($q_dead);
?>
--EXPECTF--
object(AMQPQueue)#%d (%d) {
["connection":"AMQPQueue":private]=>
%a
["channel":"AMQPQueue":private]=>
%a
["name":"AMQPQueue":private]=>
string(%d) "test.queue.%s"
["consumerTag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["autoDelete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(0) {
}
}
object(AMQPQueue)#%d (%d) {
["connection":"AMQPQueue":private]=>
%a
["channel":"AMQPQueue":private]=>
%a
["name":"AMQPQueue":private]=>
string(%d) "test.queue.dead.%s"
["consumerTag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["autoDelete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(%d) {
["x-dead-letter-exchange"]=>
string(0) ""
["x-dead-letter-routing-key"]=>
string(%d) "test.queue.%s"
["x-message-ttl"]=>
int(100000)
["x-null"]=>
NULL
["x-array"]=>
array(2) {
[0]=>
int(0)
[1]=>
int(3)
}
["x-hash"]=>
array(1) {
["foo"]=>
string(3) "bar"
}
["x-timestamp"]=>
object(AMQPTimestamp)#%d (%d) {
["timestamp":"AMQPTimestamp":private]=>
float(404)
}
["x-decimal"]=>
object(AMQPDecimal)#%d (%d) {
["exponent":"AMQPDecimal":private]=>
int(1)
["significand":"AMQPDecimal":private]=>
int(2)
}
["x-custom-value"]=>
object(MyValue)#%d (%d) {
}
}
}
object(AMQPQueue)#%d (%d) {
["connection":"AMQPQueue":private]=>
%a
["channel":"AMQPQueue":private]=>
%a
["name":"AMQPQueue":private]=>
string(%d) "test.queue.dead.%s"
["consumerTag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["autoDelete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(%d) {
["x-dead-letter-exchange"]=>
string(0) ""
["x-dead-letter-routing-key"]=>
string(%d) "test.queue.%s"
["x-message-ttl"]=>
int(100000)
["x-array"]=>
array(2) {
[0]=>
int(0)
[1]=>
int(3)
}
["x-hash"]=>
array(1) {
["foo"]=>
string(3) "bar"
}
["x-timestamp"]=>
object(AMQPTimestamp)#%d (%d) {
["timestamp":"AMQPTimestamp":private]=>
float(404)
}
["x-decimal"]=>
object(AMQPDecimal)#%d (%d) {
["exponent":"AMQPDecimal":private]=>
int(1)
["significand":"AMQPDecimal":private]=>
int(2)
}
["x-custom-value"]=>
object(MyValue)#%d (%d) {
}
}
}
diff --git a/amqp-2.1.0/tests/amqpqueue_setFlags.phpt b/amqp-2.1.1/tests/amqpqueue_setFlags.phpt
similarity index 63%
rename from amqp-2.1.0/tests/amqpqueue_setFlags.phpt
rename to amqp-2.1.1/tests/amqpqueue_setFlags.phpt
index 8e84f79..1c19f94 100644
--- a/amqp-2.1.0/tests/amqpqueue_setFlags.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_setFlags.phpt
@@ -1,24 +1,24 @@
--TEST--
AMQPQueue::setFlags(null)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
$q = new AMQPQueue($ch);
$q->setFlags(null);
var_dump($q->getFlags())
?>
==DONE==
--EXPECTF--
int(0)
==DONE==
diff --git a/amqp-2.1.0/tests/amqpqueue_unbind_basic_empty_routing_key.phpt b/amqp-2.1.1/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
similarity index 79%
rename from amqp-2.1.0/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
rename to amqp-2.1.1/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
index 994e3c2..91480ad 100644
--- a/amqp-2.1.0/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
@@ -1,37 +1,37 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
$queue->declareQueue();
var_dump($queue->bind($ex->getName()));
var_dump($queue->unbind($ex->getName()));
var_dump($queue->bind($ex->getName(), null));
var_dump($queue->unbind($ex->getName(), null));
$queue->delete();
$ex->delete();
?>
--EXPECT--
NULL
NULL
NULL
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_unbind_basic_headers_arguments.phpt b/amqp-2.1.1/tests/amqpqueue_unbind_basic_headers_arguments.phpt
similarity index 79%
rename from amqp-2.1.0/tests/amqpqueue_unbind_basic_headers_arguments.phpt
rename to amqp-2.1.1/tests/amqpqueue_unbind_basic_headers_arguments.phpt
index d85b4e2..44f3c51 100644
--- a/amqp-2.1.0/tests/amqpqueue_unbind_basic_headers_arguments.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_unbind_basic_headers_arguments.phpt
@@ -1,35 +1,35 @@
--TEST--
AMQPQueue
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_DIRECT);
$ex->declareExchange();
$queue = new AMQPQueue($ch);
$queue->setName("queue-" . bin2hex(random_bytes(32)));
$queue->declareQueue();
$arguments = array('x-match' => 'all', 'type' => 'custom');
var_dump($queue->bind($ex->getName(), '', $arguments));
var_dump($queue->unbind($ex->getName(), '', $arguments));
$queue->delete();
$ex->delete();
?>
--EXPECT--
NULL
NULL
diff --git a/amqp-2.1.0/tests/amqpqueue_var_dump.phpt b/amqp-2.1.1/tests/amqpqueue_var_dump.phpt
similarity index 84%
rename from amqp-2.1.0/tests/amqpqueue_var_dump.phpt
rename to amqp-2.1.1/tests/amqpqueue_var_dump.phpt
index f5bdeea..f341e0d 100644
--- a/amqp-2.1.0/tests/amqpqueue_var_dump.phpt
+++ b/amqp-2.1.1/tests/amqpqueue_var_dump.phpt
@@ -1,46 +1,46 @@
--TEST--
AMQPQueue var_dump
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange1');
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue_var_dump');
$q->declareQueue();
var_dump($q);
?>
--EXPECTF--
object(AMQPQueue)#4 (9) {
["connection":"AMQPQueue":private]=>
%a
["channel":"AMQPQueue":private]=>
%a
["name":"AMQPQueue":private]=>
string(14) "queue_var_dump"
["consumerTag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["autoDelete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(0) {
}
}
diff --git a/amqp-2.1.0/tests/amqptimestamp.phpt b/amqp-2.1.1/tests/amqptimestamp.phpt
similarity index 93%
rename from amqp-2.1.0/tests/amqptimestamp.phpt
rename to amqp-2.1.1/tests/amqptimestamp.phpt
index f3babf2..193fb06 100644
--- a/amqp-2.1.0/tests/amqptimestamp.phpt
+++ b/amqp-2.1.1/tests/amqptimestamp.phpt
@@ -1,50 +1,50 @@
--TEST--
AMQPTimestamp
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$timestamp = new AMQPTimestamp(100000);
var_dump($timestamp->getTimestamp(), (string) $timestamp);
var_dump($timestamp === $timestamp->toAmqpValue());
var_dump($timestamp instanceof AMQPValue);
$timestamp = new AMQPTimestamp(100000.1);
var_dump($timestamp->getTimestamp(), (string) $timestamp);
try {
new AMQPTimestamp(AMQPTimestamp::MIN - 1);
} catch (AMQPValueException $e) {
echo $e->getMessage() . "\n";
}
try {
new AMQPTimestamp(INF);
} catch (AMQPValueException $e) {
echo $e->getMessage() . "\n";
}
var_dump((new ReflectionClass("AMQPTimestamp"))->isFinal());
var_dump(number_format(AMQPTimestamp::MAX, 0, '.', '_'));
var_dump(AMQPTimestamp::MIN);
?>
==END==
--EXPECTF--
float(100000)
string(6) "100000"
bool(true)
bool(true)
float(100000)
string(6) "100000"
The timestamp parameter must be greater than 0.
The timestamp parameter must be less than 18446744073709551616.
bool(true)
string(26) "18_446_744_073_709_551_616"
float(0)
==END==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/bug_17831.phpt b/amqp-2.1.1/tests/bug_17831.phpt
similarity index 74%
rename from amqp-2.1.0/tests/bug_17831.phpt
rename to amqp-2.1.1/tests/bug_17831.phpt
index 7ac56a4..5513dd8 100644
--- a/amqp-2.1.0/tests/bug_17831.phpt
+++ b/amqp-2.1.1/tests/bug_17831.phpt
@@ -1,29 +1,29 @@
--TEST--
Segfault when publishing to non existent exchange
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
try {
$ex->publish("data", "bar");
echo "Success\n";
} catch (Exception $e) {
echo "Success\n";
}
$ex->delete();
?>
--EXPECT--
Success
diff --git a/amqp-2.1.0/tests/bug_19707.phpt b/amqp-2.1.1/tests/bug_19707.phpt
similarity index 89%
rename from amqp-2.1.0/tests/bug_19707.phpt
rename to amqp-2.1.1/tests/bug_19707.phpt
index 272730b..d2749db 100644
--- a/amqp-2.1.0/tests/bug_19707.phpt
+++ b/amqp-2.1.1/tests/bug_19707.phpt
@@ -1,65 +1,65 @@
--TEST--
AMQPQueue::get() doesn't return the message
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_testing_19707");
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue' . bin2hex(random_bytes(32)));
$q->setFlags(AMQP_DURABLE);
$q->declareQueue();
$q->bind($ex->getName(), 'routing.key');
$ex->publish('message', 'routing.key');
$msg = $q->get();
echo "message received from get:\n";
$funcs = array(
'getAppId', 'getBody', 'getContentEncoding', 'getContentType',
'getCorrelationId', 'getDeliveryTag', 'getExchangeName', 'getExpiration',
'getHeaders', 'getMessageId', 'getPriority', 'getReplyTo', 'getRoutingKey',
'getTimeStamp', 'getType', 'getUserId', 'isRedelivery'
);
foreach ($funcs as $func) {
printf("%s => %s\n", $func, var_export($msg->$func(), true));
};
$q->delete();
$ex->delete();
?>
--EXPECT--
message received from get:
getAppId => NULL
getBody => 'message'
getContentEncoding => NULL
getContentType => 'text/plain'
getCorrelationId => NULL
getDeliveryTag => 1
getExchangeName => 'exchange_testing_19707'
getExpiration => NULL
getHeaders => array (
)
getMessageId => NULL
getPriority => 0
getReplyTo => NULL
getRoutingKey => 'routing.key'
getTimeStamp => 0
getType => NULL
getUserId => NULL
isRedelivery => false
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/bug_19840.phpt b/amqp-2.1.1/tests/bug_19840.phpt
similarity index 87%
rename from amqp-2.1.0/tests/bug_19840.phpt
rename to amqp-2.1.1/tests/bug_19840.phpt
index c48410e..bd0e09c 100644
--- a/amqp-2.1.0/tests/bug_19840.phpt
+++ b/amqp-2.1.1/tests/bug_19840.phpt
@@ -1,24 +1,24 @@
--TEST--
Bug 19840: Connection Exception
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
$lServer['host'] = 'ip.ad.dr.ess';
$lServer['port'] = '5672';
$lServer['vhost'] = '/test';
$lServer['user'] = 'test';
$lServer['password'] = 'test';
try {
$cnn = new AMQPConnection($lServer);
$cnn->connect();
echo "No exception thrown\n";
} catch (Exception $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage();
}
?>
--EXPECT--
AMQPConnectionException(0): Socket error: could not connect to host, hostname lookup failed
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/bug_351.phpt b/amqp-2.1.1/tests/bug_351.phpt
similarity index 85%
rename from amqp-2.1.0/tests/bug_351.phpt
rename to amqp-2.1.1/tests/bug_351.phpt
index 15a33c0..54143b5 100644
--- a/amqp-2.1.0/tests/bug_351.phpt
+++ b/amqp-2.1.1/tests/bug_351.phpt
@@ -1,51 +1,51 @@
--TEST--
AMQPEnvelope::getBody returns false instead of empty string
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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_FANOUT);
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue1' . bin2hex(random_bytes(32)));
$q->declareQueue();
$q->bind($ex->getName(), '*');
$ex->publish('');
$msg = $q->get(AMQP_AUTOACK);
echo "MSG1\n";
var_dump($msg->getBody(), $msg->getRoutingKey(), $msg->getConsumerTag(), $msg->getDeliveryTag(), $msg->getExchangeName());
$msg2 = new AMQPEnvelope();
echo "MSG2\n";
var_dump($msg2->getBody(), $msg2->getRoutingKey(), $msg2->getConsumerTag(), $msg2->getDeliveryTag(), $msg2->getExchangeName());
?>
==DONE==
--EXPECTF--
MSG1
string(0) ""
string(0) ""
string(0) ""
int(%d)
string(%d) "exchange%s"
MSG2
string(0) ""
string(0) ""
NULL
NULL
NULL
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/bug_385.phpt b/amqp-2.1.1/tests/bug_385.phpt
similarity index 84%
rename from amqp-2.1.0/tests/bug_385.phpt
rename to amqp-2.1.1/tests/bug_385.phpt
index 87fa2cb..4d18d1f 100644
--- a/amqp-2.1.0/tests/bug_385.phpt
+++ b/amqp-2.1.1/tests/bug_385.phpt
@@ -1,44 +1,44 @@
--TEST--
#385 Testing consumer cleared on cancel
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel = new AMQPChannel($cnn);
$exchange = new AMQPExchange($channel);
$queue = new AMQPQueue($channel);
$queue->declareQueue();
// Asynchronously consuming
$queue->consume(null, AMQP_NOPARAM, 'someid');
// Showing that current consumer tag is from last consume call
echo $queue->getConsumerTag() ?? 'none';
echo PHP_EOL;
// Cancel by a different consumer tag than the latest one -> expecting the consumer tag to not clear
$queue->cancel('someotherid');
echo $queue->getConsumerTag() ?? 'none';
echo PHP_EOL;
// Cancel by consumer tag -> expecting the current consumer tag to clear
$queue->cancel('someid');
// Current consumer tag should be null as consumer has been cancelled
echo $queue->getConsumerTag() ?? 'none';
?>
--EXPECTF--
someid
someid
none
diff --git a/amqp-2.1.0/tests/bug_61533.phpt b/amqp-2.1.1/tests/bug_61533.phpt
similarity index 78%
rename from amqp-2.1.0/tests/bug_61533.phpt
rename to amqp-2.1.1/tests/bug_61533.phpt
index ca2cb67..29716d6 100644
--- a/amqp-2.1.0/tests/bug_61533.phpt
+++ b/amqp-2.1.1/tests/bug_61533.phpt
@@ -1,28 +1,28 @@
--TEST--
Constructing AMQPQueue with AMQPConnection segfaults
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$chan = new AMQPChannel($cnn);
if (!class_exists('TypeError')) {
class TypeError extends Exception {}
}
try {
error_reporting(error_reporting() & ~E_WARNING);
$queue = new AMQPQueue($cnn);
} catch (TypeError $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), '.', PHP_EOL; // we pad exception message with dot to make EXPETF be the same on PHP 5 and PHP 7
}
?>
--EXPECTF--
%s AMQPChannel%s AMQPConnection%s
diff --git a/amqp-2.1.0/tests/bug_62354.phpt b/amqp-2.1.1/tests/bug_62354.phpt
similarity index 87%
rename from amqp-2.1.0/tests/bug_62354.phpt
rename to amqp-2.1.1/tests/bug_62354.phpt
index 380ae6b..a92fe7c 100644
--- a/amqp-2.1.0/tests/bug_62354.phpt
+++ b/amqp-2.1.1/tests/bug_62354.phpt
@@ -1,27 +1,27 @@
--TEST--
Constructing AMQPQueue with AMQPConnection segfaults
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--FILE--
<?php
class Amqptest {
public $conn = NULL;
};
$o = new Amqptest();
$o->conn = new AMQPConnection();
$funcs = array(
'getHost', 'getLogin', 'getPassword', 'getPort', 'getVHost', 'isConnected'
);
foreach ($funcs as $func) {
printf("%s => %s\n", $func, var_export($o->conn->$func(), true));
};
?>
--EXPECT--
getHost => 'localhost'
getLogin => 'guest'
getPassword => 'guest'
getPort => 5672
getVHost => '/'
isConnected => false
diff --git a/amqp-2.1.0/tests/bug_gh147.phpt b/amqp-2.1.1/tests/bug_gh147.phpt
similarity index 89%
rename from amqp-2.1.0/tests/bug_gh147.phpt
rename to amqp-2.1.1/tests/bug_gh147.phpt
index 5639754..00a169c 100644
--- a/amqp-2.1.0/tests/bug_gh147.phpt
+++ b/amqp-2.1.1/tests/bug_gh147.phpt
@@ -1,64 +1,64 @@
--TEST--
#147 Segfault when catchable fatal error happens in consumer
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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
// Register error handler to be able to catch the error
// as it's not catchable with try/catch before PHP 7.4
// see https://github.com/php/php-src/pull/3887
function exception_error_handler($severity, $message, $file, $line) {
echo $message;
exit;
}
set_error_handler("exception_error_handler");
$time = microtime(true);
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
$channel = new AMQPChannel($cnn);
$channel->setPrefetchCount(2);
$exchange = new AMQPExchange($channel);
$exchange->setType(AMQP_EX_TYPE_TOPIC);
$exchange->setName('test_' . $time);
$exchange->setFlags(AMQP_AUTODELETE);
$exchange->declareExchange();
$queue = new AMQPQueue($channel);
$queue->setName('test_' . $time);
$queue->declareQueue();
$queue->bind($exchange->getName(), 'test');
$exchange->publish('test message', 'test');
echo 'start'.PHP_EOL;
try {
$queue->consume(function(AMQPEnvelope $e) use (&$consume) {
echo 'consuming'.PHP_EOL;
$e . 'should fail';
return false;
});
} catch (Throwable $ex) {
// Exception is only thrown as of PHP 7.4
echo $ex->getMessage();
exit;
}
echo 'done', PHP_EOL;
?>
--EXPECTF--
start
consuming
Object of class %s could not be converted to string
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/bug_gh155_direct_reply_to.phpt b/amqp-2.1.1/tests/bug_gh155_direct_reply_to.phpt
similarity index 91%
rename from amqp-2.1.0/tests/bug_gh155_direct_reply_to.phpt
rename to amqp-2.1.1/tests/bug_gh155_direct_reply_to.phpt
index fa179da..84f4d8b 100644
--- a/amqp-2.1.0/tests/bug_gh155_direct_reply_to.phpt
+++ b/amqp-2.1.1/tests/bug_gh155_direct_reply_to.phpt
@@ -1,78 +1,78 @@
--TEST--
#155 RabbitMQ's Direct reply-to (related to consume multiple)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel = new AMQPChannel($cnn);
$exchange = new AMQPExchange($channel);
$q_reply_to = new AMQPQueue($channel);
$q_reply_to->setName('amq.rabbitmq.reply-to');
$q_reply_to->consume(null, AMQP_AUTOACK);
// this will be kind out long-living queue to
$q_request = new AMQPQueue($channel);
$q_request->setName('reply-to-requests');
$q_request->setFlags(AMQP_DURABLE);
$q_request->declareQueue();
$q_request->purge();
$q_request_name = $q_request->getName();
echo 'Publishing request...' . PHP_EOL;
$exchange->publish('request', $q_request_name, AMQP_NOPARAM, array('reply_to' => 'amq.rabbitmq.reply-to'));
$request_message = $q_request->get(AMQP_AUTOACK);
$reply_to = $request_message->getReplyTo();
echo 'Reply-to queue: ', $reply_to, PHP_EOL;
echo 'Prepare response queue...' . PHP_EOL;
$channel_2 = new AMQPChannel($cnn);
$q_reply = new AMQPQueue($channel_2);
$q_reply->setName($reply_to);
$q_reply->setFlags(AMQP_PASSIVE);
$q_reply->declareQueue();
echo 'Publishing response...' . PHP_EOL;
$exchange->publish('response', $reply_to);
echo 'Waiting for reply...' . PHP_EOL;
$q_reply_to->consume(function (AMQPEnvelope $message, AMQPQueue $queue) {
echo $message->getBody() . ': ' . $message->getRoutingKey() . PHP_EOL;
echo 'Received on ', $queue->getName(), ' queue', PHP_EOL;
return false;
}, AMQP_JUST_CONSUME);
echo 'done', PHP_EOL;
?>
--EXPECTF--
Publishing request...
Reply-to queue: amq.rabbitmq.reply-to.%s.%s==
Prepare response queue...
Publishing response...
Waiting for reply...
response: amq.rabbitmq.reply-to.%s.%s==
Received on amq.rabbitmq.reply-to queue
done
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/bug_gh50-1.phpt b/amqp-2.1.1/tests/bug_gh50-1.phpt
similarity index 74%
rename from amqp-2.1.0/tests/bug_gh50-1.phpt
rename to amqp-2.1.1/tests/bug_gh50-1.phpt
index 45e0474..46b6103 100644
--- a/amqp-2.1.0/tests/bug_gh50-1.phpt
+++ b/amqp-2.1.1/tests/bug_gh50-1.phpt
@@ -1,31 +1,31 @@
--TEST--
Channel creation race condition (https://github.com/pdezwart/php-amqp/issues/50) (1)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
for ($i = 0; $i < 3; $i++) {
$channel = new AMQPChannel($cnn);
var_dump($channel->getChannelId());
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);
$queue->declareQueue();
$queue->delete();
}
?>
==DONE==
--EXPECT--
int(1)
int(2)
int(3)
==DONE==
diff --git a/amqp-2.1.0/tests/bug_gh50-2.phpt b/amqp-2.1.1/tests/bug_gh50-2.phpt
similarity index 76%
rename from amqp-2.1.0/tests/bug_gh50-2.phpt
rename to amqp-2.1.1/tests/bug_gh50-2.phpt
index 74b9589..cc814af 100644
--- a/amqp-2.1.0/tests/bug_gh50-2.phpt
+++ b/amqp-2.1.1/tests/bug_gh50-2.phpt
@@ -1,34 +1,34 @@
--TEST--
Channel creation race condition (https://github.com/pdezwart/php-amqp/issues/50) (2)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
for ($i = 0; $i < 3; $i++) {
$channel = new AMQPChannel($cnn);
var_dump($channel->getChannelId());
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);
$queue->declareQueue();
$queue->delete();
unset($queue);
unset($channel);
}
?>
==DONE==
--EXPECT--
int(1)
int(1)
int(1)
==DONE==
diff --git a/amqp-2.1.0/tests/bug_gh50-3.phpt b/amqp-2.1.1/tests/bug_gh50-3.phpt
similarity index 83%
rename from amqp-2.1.0/tests/bug_gh50-3.phpt
rename to amqp-2.1.1/tests/bug_gh50-3.phpt
index 2f817a4..f0c7f1d 100644
--- a/amqp-2.1.0/tests/bug_gh50-3.phpt
+++ b/amqp-2.1.1/tests/bug_gh50-3.phpt
@@ -1,52 +1,52 @@
--TEST--
Channel creation race condition (https://github.com/pdezwart/php-amqp/issues/50) (3)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
for ($i = 0; $i < 3; $i++) {
$channel = new AMQPChannel($cnn);
var_dump($channel->getChannelId());
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);
$queue->declareQueue();
$queue->delete();
}
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
for ($i = 0; $i < 3; $i++) {
$channel = new AMQPChannel($cnn);
var_dump($channel->getChannelId());
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);
$queue->declareQueue();
$queue->delete();
}
?>
==DONE==
--EXPECT--
int(1)
int(2)
int(3)
int(1)
int(2)
int(3)
==DONE==
diff --git a/amqp-2.1.0/tests/bug_gh50-4.phpt b/amqp-2.1.1/tests/bug_gh50-4.phpt
similarity index 84%
rename from amqp-2.1.0/tests/bug_gh50-4.phpt
rename to amqp-2.1.1/tests/bug_gh50-4.phpt
index adba61c..5747724 100644
--- a/amqp-2.1.0/tests/bug_gh50-4.phpt
+++ b/amqp-2.1.1/tests/bug_gh50-4.phpt
@@ -1,54 +1,54 @@
--TEST--
Channel creation race condition (https://github.com/pdezwart/php-amqp/issues/50) (4)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channels = array();
for ($i = 0; $i < 3; $i++) {
$channel = $channels[] = new AMQPChannel($cnn);
var_dump($channel->getChannelId());
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);
$queue->declareQueue();
$queue->delete();
}
$cnn = new AMQPConnection();
$cnn->setHost(getenv('PHP_AMQP_HOST'));
$cnn->connect();
for ($i = 0; $i < 3; $i++) {
$channel = $channels[] = new AMQPChannel($cnn);
var_dump($channel->getChannelId());
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);
$queue->declareQueue();
$queue->delete();
}
?>
==DONE==
--EXPECT--
int(1)
int(2)
int(3)
int(1)
int(2)
int(3)
==DONE==
diff --git a/amqp-2.1.0/tests/bug_gh53-2.phpt b/amqp-2.1.1/tests/bug_gh53-2.phpt
similarity index 83%
rename from amqp-2.1.0/tests/bug_gh53-2.phpt
rename to amqp-2.1.1/tests/bug_gh53-2.phpt
index 0b87682..e765c00 100644
--- a/amqp-2.1.0/tests/bug_gh53-2.phpt
+++ b/amqp-2.1.1/tests/bug_gh53-2.phpt
@@ -1,40 +1,40 @@
--TEST--
Upgrade to RabbitMQ 3.1.0-1: AMQPConnectionException: connection closed unexpectedly (2)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel = new AMQPChannel($cnn);
$exchange = new AMQPExchange($channel);
$exchange->setName('exchange' . bin2hex(random_bytes(32)));
$exchange->setType(AMQP_EX_TYPE_TOPIC);
$exchange->declareExchange();
$queue = new AMQPQueue($channel);
$queue->setName('queue1' . bin2hex(random_bytes(32)));
$queue->declareQueue();
$queue->bind($exchange->getName(), '#');
$exchange->publish('body1', 'routing.1');
$exchange->publish('body2', 'routing.1');
$msg = $queue->get(AMQP_AUTOACK);
var_dump($msg->getBody());
$msg = $queue->get(AMQP_AUTOACK);
var_dump($msg->getBody());
?>
==DONE==
--EXPECT--
string(5) "body1"
string(5) "body2"
==DONE==
diff --git a/amqp-2.1.0/tests/bug_gh53.phpt b/amqp-2.1.1/tests/bug_gh53.phpt
similarity index 85%
rename from amqp-2.1.0/tests/bug_gh53.phpt
rename to amqp-2.1.1/tests/bug_gh53.phpt
index 0de3327..a4634c5 100644
--- a/amqp-2.1.0/tests/bug_gh53.phpt
+++ b/amqp-2.1.1/tests/bug_gh53.phpt
@@ -1,44 +1,44 @@
--TEST--
Upgrade to RabbitMQ 3.1.0-1: AMQPConnectionException: connection closed unexpectedly
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel = new AMQPChannel($cnn);
var_dump($channel->getPrefetchSize());
var_dump($channel->getPrefetchCount());
$channel->setPrefetchCount(10);
var_dump($channel->getPrefetchSize());
var_dump($channel->getPrefetchCount());
// NOTE: RabbitMQ Doesn't support prefetch size
try {
$channel->setPrefetchSize(1024);
} catch (AMQPConnectionException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
var_dump($channel->isConnected());
var_dump($cnn->isConnected());
var_dump($channel->getPrefetchSize());
var_dump($channel->getPrefetchCount());
?>
--EXPECTF--
int(0)
int(3)
int(0)
int(10)
AMQPConnectionException(540): Server connection error: 540, message: NOT_IMPLEMENTED - prefetch_size!=0 (%d)
bool(false)
bool(false)
int(0)
int(10)
diff --git a/amqp-2.1.0/tests/bug_gh72-1.phpt b/amqp-2.1.1/tests/bug_gh72-1.phpt
similarity index 70%
rename from amqp-2.1.0/tests/bug_gh72-1.phpt
rename to amqp-2.1.1/tests/bug_gh72-1.phpt
index ac0106a..9673a89 100644
--- a/amqp-2.1.0/tests/bug_gh72-1.phpt
+++ b/amqp-2.1.1/tests/bug_gh72-1.phpt
@@ -1,22 +1,22 @@
--TEST--
#72 Publishing to an exchange with an empty name is valid and should not throw an exception (1)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel = new AMQPChannel($cnn);
$exchange = new AMQPExchange($channel);
$exchange->setName('');
$exchange->publish('msg', 'key');
?>
==DONE==
--EXPECT--
==DONE==
diff --git a/amqp-2.1.0/tests/bug_gh72-2.phpt b/amqp-2.1.1/tests/bug_gh72-2.phpt
similarity index 77%
rename from amqp-2.1.0/tests/bug_gh72-2.phpt
rename to amqp-2.1.1/tests/bug_gh72-2.phpt
index c0ae5e2..b6534c0 100644
--- a/amqp-2.1.0/tests/bug_gh72-2.phpt
+++ b/amqp-2.1.1/tests/bug_gh72-2.phpt
@@ -1,24 +1,24 @@
--TEST--
#72 Publishing to an exchange with an empty name is valid and should not throw an exception (2)
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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();
$channel = new AMQPChannel($cnn);
$exchange = new AMQPExchange($channel);
try {
$exchange->setName(str_repeat('a', 256));
} catch (AMQPExchangeException $e) {
echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
AMQPExchangeException(0): Invalid exchange name given, must be less than 255 characters long.
diff --git a/amqp-2.1.0/tests/ini_validation_failure.phpt b/amqp-2.1.1/tests/ini_validation_failure.phpt
similarity index 98%
rename from amqp-2.1.0/tests/ini_validation_failure.phpt
rename to amqp-2.1.1/tests/ini_validation_failure.phpt
index a0a171b..0ad198e 100644
--- a/amqp-2.1.0/tests/ini_validation_failure.phpt
+++ b/amqp-2.1.1/tests/ini_validation_failure.phpt
@@ -1,64 +1,64 @@
--TEST--
Bad INI settings are rejected
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
?>
--INI--
amqp.host=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
amqp.vhost=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
amqp.port=-1
amqp.login=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
amqp.password=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
amqp.read_timeout=-1
amqp.write_timeout=-1
amqp.connect_timeout=-1
amqp.rpc_timeout=-1
amqp.timeout=-1
amqp.prefetch_count=-1
amqp.prefetch_size=-1
amqp.global_prefetch_count=-1
amqp.global_prefetch_size=-1
amqp.heartbeat=-1
amqp.channel_max=257
amqp.frame_max=-1
--FILE--
<?php
var_dump(ini_get('amqp.host'));
var_dump(ini_get('amqp.vhost'));
var_dump(ini_get('amqp.port'));
var_dump(ini_get('amqp.login'));
var_dump(ini_get('amqp.password'));
var_dump(ini_get('amqp.read_timeout'));
var_dump(ini_get('amqp.write_timeout'));
var_dump(ini_get('amqp.connect_timeout'));
var_dump(ini_get('amqp.rpc_timeout'));
var_dump(ini_get('amqp.timeout'));
var_dump(ini_get('amqp.prefetch_count'));
var_dump(ini_get('amqp.prefetch_size'));
var_dump(ini_get('amqp.global_prefetch_count'));
var_dump(ini_get('amqp.global_prefetch_size'));
var_dump(ini_get('amqp.heartbeat'));
var_dump(ini_get('amqp.channel_max'));
var_dump(ini_get('amqp.frame_max'));
?>
==DONE==
--EXPECT--
string(9) "localhost"
string(1) "/"
string(4) "5672"
string(5) "guest"
string(5) "guest"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(0) ""
string(1) "3"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(3) "256"
string(6) "131072"
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/package-version.phpt b/amqp-2.1.1/tests/package-version.phpt
similarity index 81%
rename from amqp-2.1.0/tests/package-version.phpt
rename to amqp-2.1.1/tests/package-version.phpt
index 0a53390..5b12f21 100644
--- a/amqp-2.1.0/tests/package-version.phpt
+++ b/amqp-2.1.1/tests/package-version.phpt
@@ -1,28 +1,28 @@
--TEST--
Compare version in package.xml and module
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!function_exists('simplexml_load_file')) print "skip";
+if (!extension_loaded("amqp")) print "skip AMQP extension is not loaded";
+elseif (!function_exists('simplexml_load_file')) print "skip SimpleXML extension is not loaded";
?>
--FILE--
<?php
$package = simplexml_load_file(dirname(__FILE__) . '/../package.xml');
$packageVersion = $package->version->release;
$ext = new ReflectionExtension('amqp');
$srcVersion = $ext->getVersion();
if (0 === strcmp($packageVersion, $srcVersion)) {
echo "package.xml matches phpinfo() output\n";
} else {
printf("src version: %s, package.xml: %s\n", $srcVersion, $packageVersion);
}
if (0 === strcmp($packageVersion, $ext->getVersion())) {
echo "package.xml matches extension version\n";
} else {
printf("ext version: %s, package.xml: %s\n", $ext->getVersion(), $packageVersion);
}
--EXPECT--
package.xml matches phpinfo() output
package.xml matches extension version
diff --git a/amqp-2.1.0/tests/serialize-custom-amqpvalue-errors.phpt b/amqp-2.1.1/tests/serialize-custom-amqpvalue-errors.phpt
similarity index 88%
rename from amqp-2.1.0/tests/serialize-custom-amqpvalue-errors.phpt
rename to amqp-2.1.1/tests/serialize-custom-amqpvalue-errors.phpt
index e400018..d00783b 100644
--- a/amqp-2.1.0/tests/serialize-custom-amqpvalue-errors.phpt
+++ b/amqp-2.1.1/tests/serialize-custom-amqpvalue-errors.phpt
@@ -1,59 +1,59 @@
--TEST--
Serialize custom AMQP value - errors
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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('ex-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
class RecursiveValue implements AMQPValue {
public function toAmqpValue()
{
return $this;
}
}
class NestedValue implements AMQPValue {
private $v;
public function __construct($v)
{
$this->v = $v;
}
public function toAmqpValue()
{
return $this->v;
}
}
try {
$ex->publish('msg', null, null, ['headers' => ['x-val' => new RecursiveValue()]]);
} catch (AMQPException $e) {
var_dump($e->getMessage());
}
$ex->publish('msg', null, null, ['headers' => ['x-val' => new NestedValue(new stdClass())]]);
$ex->publish('msg', null, null, ['headers' => ['x-val' => new NestedValue(new NestedValue(new stdClass()))]]);
?>
==DONE==
--EXPECTF--
string(%d) "Maximum serialization depth of 128 reached while serializing value"
Warning: AMQPExchange::publish(): Ignoring field 'x-val' due to unsupported value type (object) in %s on line %d
Warning: AMQPExchange::publish(): Ignoring field 'x-val' due to unsupported value type (object) in %s on line %d
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/serialize-custom-amqpvalue.phpt b/amqp-2.1.1/tests/serialize-custom-amqpvalue.phpt
similarity index 91%
rename from amqp-2.1.0/tests/serialize-custom-amqpvalue.phpt
rename to amqp-2.1.1/tests/serialize-custom-amqpvalue.phpt
index aca3979..0d91bc5 100644
--- a/amqp-2.1.0/tests/serialize-custom-amqpvalue.phpt
+++ b/amqp-2.1.1/tests/serialize-custom-amqpvalue.phpt
@@ -1,80 +1,80 @@
--TEST--
Serialize custom AMQP value
--SKIPIF--
<?php
-if (!extension_loaded("amqp")) print "skip";
-if (!getenv("PHP_AMQP_HOST")) print "skip";
+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('ex-' . bin2hex(random_bytes(32)));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$q = new AMQPQueue($ch);
$q->setName('q-' . bin2hex(random_bytes(32)));
$q->declare();
$q->bind($ex->getName());
class MyAmqpValue implements AMQPValue {
public function toAmqpValue()
{
return 'foo';
}
}
class MyNestedAmqpValue implements AMQPValue {
private $val;
public function __construct($val) {
$this->val = $val;
}
public function toAmqpValue() {
return $this->val;
}
}
$ex->publish('msg', null, null, ['headers' => [
'x-val' => new MyAmqpValue(),
'x-nested' => new MyNestedAmqpValue(new MyAmqpValue()),
'x-array' => [new MyNestedAmqpValue(new MyAmqpValue())],
'x-array-nested' => new MyNestedAmqpValue([new MyNestedAmqpValue(1), 2]),
'x-nested-decimal' => new MyNestedAmqpValue(new AMQPDecimal(1, 2345)),
'x-nested-timestamp' => new MyNestedAmqpValue(new AMQPTimestamp(987))
]]);
$msg = $q->get(AMQP_AUTOACK);
var_dump($msg->getHeader('x-val'));
var_dump($msg->getHeader('x-nested'));
var_dump($msg->getHeader('x-array'));
var_dump($msg->getHeader('x-array-nested'));
var_dump($msg->getHeader('x-nested-decimal')->getExponent());
var_dump($msg->getHeader('x-nested-decimal')->getSignificand());
var_dump($msg->getHeader('x-nested-timestamp')->getTimestamp());
?>
==DONE==
--EXPECT--
string(3) "foo"
string(3) "foo"
array(1) {
[0]=>
string(3) "foo"
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
int(1)
int(2345)
float(987)
==DONE==
\ No newline at end of file
diff --git a/amqp-2.1.0/tests/testtest.phpt b/amqp-2.1.1/tests/testtest.phpt
similarity index 96%
rename from amqp-2.1.0/tests/testtest.phpt
rename to amqp-2.1.1/tests/testtest.phpt
index cd69bd8..d364cf2 100644
--- a/amqp-2.1.0/tests/testtest.phpt
+++ b/amqp-2.1.1/tests/testtest.phpt
@@ -1,57 +1,57 @@
--TEST--
Test the tests
--FILE--
<?php
foreach (glob(__DIR__ . '/*.phpt') as $test) {
if ($test === __FILE__ . 't') {
continue;
}
$content = file_get_contents($test);
if (!$content) {
printf("%s could not be read\n", basename($test));
continue;
}
if (strpos($content, "\n--SKIPIF--\n") == false) {
printf("%s does not contain SKIPIF section\n", basename($test));
continue;
}
if (!preg_match('/--FILE--(?P<testCode>.*?)--[A-Z]+--/s', $content, $matches)) {
printf("%s TEST section cannot be parsed\n", basename($test));
continue;
}
['testCode' => $testCode] = $matches;
if (!preg_match('/--SKIPIF--(?P<skipCode>.*?)--[A-Z]+--/s', $content, $matches)) {
printf("%s SKIPIF section cannot be parsed\n", basename($test));
continue;
}
['skipCode' => $skipCode] = $matches;
- if (!preg_match('/if\s*\(!extension_loaded\("amqp"\)\)\s*\{?\s*print "skip";/', $skipCode)) {
+ if (!preg_match('/if\s*\(!extension_loaded\("amqp"\)\)\s*\{?\s*print "skip AMQP extension is not loaded";/', $skipCode)) {
printf("%s --SKIP-- does not check for the extension being present\n", basename($test));
continue;
}
$hostVars = ['PHP_AMQP_HOST', 'PHP_AMQP_SSL_HOST'];
foreach ($hostVars as $hostVar) {
if (strpos($testCode, $hostVar) !== false && !preg_match('/!getenv\(["\']' . $hostVar . '/', $skipCode)) {
printf("%s --TEST-- contains reference to %s but --SKIP-- does not check for it\n", basename($test), $hostVar);
continue 2;
}
if (strpos($testCode, $hostVar) === false && strpos($skipCode, $hostVar) !== false) {
printf("%s --TEST-- contains no reference to %s but --SKIP-- checks for reference\n", basename($test), $hostVar);
continue 2;
}
}
}
?>
==DONE==
--EXPECT--
==DONE==
\ No newline at end of file
diff --git a/package.xml b/package.xml
index fc89a58..166ca95 100644
--- a/package.xml
+++ b/package.xml
@@ -1,1134 +1,1166 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.10.13" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>amqp</name>
<channel>pecl.php.net</channel>
<summary>Communicate with any AMQP compliant server</summary>
<description>This extension can communicate with any AMQP spec 0-9-1 compatible server, such as RabbitMQ, OpenAMQP and Qpid, giving you the ability to create and delete exchanges and queues, as well as publish to any exchange and consume from any queue.</description>
<lead>
<name>Lars Strojny</name>
<user>lstrojny</user>
<email>lstrojny@php.net</email>
<active>yes</active>
</lead>
<lead>
<name>Pieter de Zwart</name>
<user>pdezwart</user>
<email>pdezwart@php.net</email>
<active>no</active>
</lead>
<developer>
<name>Bogdan Padalko</name>
<user>pinepain</user>
<email>pinepain@gmail.com</email>
<active>yes</active>
</developer>
- <date>2023-09-07</date>
- <time>06:52:04</time>
+ <date>2023-10-12</date>
+ <time>13:06:43</time>
<version>
- <release>2.1.0</release>
- <api>2.1.0</api>
+ <release>2.1.1</release>
+ <api>2.1.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
-- AMQPValue interface for custom value objects (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/473)
- - Implement AMQPQueue::recover() to provide the basic.recover method (fixes #478) (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/484)
- - Fix double free when an error occurs in AMQPQueue::consume() (Jan Prachar &lt;jan.prachar@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/482)
- - Revamp error handling (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/485)
- - Refactor AMQPQueue::consume error handling (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/483)
- - Use RETURN_THROWS for parameter parsing errors (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/474)
- - Fix auto-formatting (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/877b2f4)
- - Remove appveyor badge (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/4971c80)
- - Replace microtime() as a randomness source (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/4503e53)
- - Fix version test for release builds (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/00a6715)
- - Remove non-ASCII characters from package.xml to work around pecl.php.net issue (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/732f7e8)
- - Bump actions/checkout from 3.5.3 to 3.6.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/475)
- - Bump symplify/easy-coding-standard from 12.0.6 to 12.0.7 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/472)
- - Bump actions/checkout from 3.5.3 to 3.6.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/471)
- - Bump actions/checkout from 3.6.0 to 4.0.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/481)
+- Fixing debug mode errors (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/502)
+ - FIX: #494 Param &quot;verify&quot; always true (Daniel Kozak &lt;kozzi11@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/497)
+ - Remove assert on undefined variable (Remi Collet &lt;remi@remirepo.net&gt;) (https://github.com/php-amqp/php-amqp/issues/486)
+ - Semantically sort changelog (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/e5bd909)
+ - Set custom PHP executable dynamically (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/503)
+ - Fixes in stub comments (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/6539de5)
+ - Refactor test skipping (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/504)
+ - Bump actions/checkout from 4.0.0 to 4.1.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/499)
+ - Bump phpstan/phpdoc-parser from 1.23.1 to 1.24.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/491)
+ - Bump phpstan/phpdoc-parser from 1.24.0 to 1.24.1 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/495)
+ - Bump shivammathur/setup-php from 2.25.5 to 2.26.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/493)
+ - Bump slevomat/coding-standard from 8.13.4 to 8.14.1 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/501)
+ - Bump symplify/easy-coding-standard from 12.0.7 to 12.0.8 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/492)
For a complete list of changes see:
-https://github.com/php-amqp/php-amqp/compare/v2.0.0...v2.1.0
+https://github.com/php-amqp/php-amqp/compare/v2.1.0...v2.1.1
</notes>
<contents>
<dir name="/">
- <file md5sum="e64aeb300c751cabd5d48709716c0ff4" name="config.m4" role="src" />
+ <file md5sum="09d1fd922d8ceb5699eb1956a70b814b" name="config.m4" role="src" />
<file md5sum="452420b308cb275132426ffa65e4e0e1" name="config.w32" role="src" />
<file md5sum="4c72f68c150d26652ea4bf5d6aa3ac2a" name="benchmark.php" role="doc" />
<file md5sum="c2bc5a8aa3fb7f8d0c924f584e20809d" name="CREDITS" role="doc" />
<file md5sum="b3e70313289e3ea66cae3089b7e571b8" name="LICENSE" role="doc" />
<file md5sum="faaa7130786487ae7bfda8adaeea93c2" name="tests/_test_helpers.php.inc" role="test" />
<file md5sum="ff1f3c4f24def8d8260292a6d27b51d0" name="amqp.c" role="src" />
<file md5sum="173a4a92fffa57165d94e4da7cd345d8" name="amqp_basic_properties.c" role="src" />
<file md5sum="a0101537ab6d719db5bc1de3c780a7eb" name="amqp_basic_properties.h" role="src" />
- <file md5sum="72d9cab85b949a5efe1528352b11dea4" name="amqp_channel.c" role="src" />
+ <file md5sum="46f62b1e4db6d290ed159eb5c8c4e484" name="amqp_channel.c" role="src" />
<file md5sum="72eb05aaedd3ba4f3813906a224aec82" name="amqp_channel.h" role="src" />
- <file md5sum="da085ae9affe7b8cbf5d0ff9d6fb00a9" name="amqp_connection.c" role="src" />
+ <file md5sum="2e03cbb27a5c9c6dd6f8d85871fc9107" name="amqp_connection.c" role="src" />
<file md5sum="d15970adc8c79c8606bfb75ff12c81d4" name="amqp_connection.h" role="src" />
- <file md5sum="6a264ee5e5b17f437bdaec0d3d182d0b" name="amqp_connection_resource.c" role="src" />
+ <file md5sum="ceb9a890b0f75ddb5e515137aeeb253b" name="amqp_connection_resource.c" role="src" />
<file md5sum="5593f3a805b5441a1ce1aa75d4794100" name="amqp_connection_resource.h" role="src" />
<file md5sum="01821f78be8c67802364ce264e0ea19f" name="amqp_decimal.c" role="src" />
<file md5sum="71d2f8c929bf674353ba2a6db828b00c" name="amqp_decimal.h" role="src" />
- <file md5sum="c982280dabb77b01eacac02abd943861" name="amqp_envelope.c" role="src" />
+ <file md5sum="657a19b93b0d2510d32e4f343473d17c" name="amqp_envelope.c" role="src" />
<file md5sum="8cad06b8f3f4c8ff2d7ab599636a16f1" name="amqp_envelope.h" role="src" />
<file md5sum="9712eafa8912a401a039557c3a05e891" name="amqp_envelope_exception.c" role="src" />
<file md5sum="5866896bd551b43905ec4ee1b85e656e" name="amqp_envelope_exception.h" role="src" />
<file md5sum="d84fa8843be9377f5a494d9ae3958a8e" name="amqp_exchange.c" role="src" />
<file md5sum="0ae7b70c8ee847cb1fc9ae6454577e2d" name="amqp_exchange.h" role="src" />
<file md5sum="3c4cf3f9c1811cfe913fdee13271e6f1" name="amqp_methods_handling.c" role="src" />
<file md5sum="4eee4ab6ea934324d616346f3eb6d25c" name="amqp_methods_handling.h" role="src" />
- <file md5sum="a3e213994359a159a5c6ba9081589afa" name="amqp_queue.c" role="src" />
+ <file md5sum="25c953fc72a2bfad3284f5c2a6c45ade" name="amqp_queue.c" role="src" />
<file md5sum="ce5b701dd7954a841eaa6d4c8efe39af" name="amqp_queue.h" role="src" />
<file md5sum="1031538169e85da367ad28491491871c" name="amqp_timestamp.c" role="src" />
<file md5sum="4f802b5afd10f5827a652bd00ebdbe2d" name="amqp_timestamp.h" role="src" />
- <file md5sum="d1a1b7d6e737091ec8460c47edeaacb4" name="amqp_type.c" role="src" />
+ <file md5sum="856840ef5ea9c34a70173be821996fc9" name="amqp_type.c" role="src" />
<file md5sum="eea964bf578016436b14b6f0d73f5702" name="amqp_type.h" role="src" />
<file md5sum="ec765424c0512c67723f054cf6f52bb2" name="amqp_value.c" role="src" />
<file md5sum="7567db8c5cab2510808fb39963eb4338" name="amqp_value.h" role="src" />
- <file md5sum="00052b550291856b7c556fc56edbda76" name="php_amqp.h" role="src" />
- <file md5sum="2fab1dca41ff47f8443b41eff7ee0bf9" name="php_amqp_version.h" role="src" />
- <file md5sum="efb7ee50e51c3a1e3470fc6fc9e2ed74" name="tests/003-channel-consumers.phpt" role="test" />
- <file md5sum="966886c4ddc6ac2fafb45c5cdc7dbd7e" name="tests/004-queue-consume-nested.phpt" role="test" />
- <file md5sum="6956f4b87180da87bdc5535e222e41d3" name="tests/004-queue-consume-orphaned.phpt" role="test" />
- <file md5sum="b4aceed2daeaa0aab1982be2eb83e6bd" name="tests/amqp_version.phpt" role="test" />
- <file md5sum="f91faff0796833aefc18aa19ed40d2fd" name="tests/amqpbasicproperties.phpt" role="test" />
- <file md5sum="21a31d354bbaf7b25d5fcb19da57384d" name="tests/amqpchannel_basicRecover.phpt" role="test" />
- <file md5sum="4fe60e221b0ae748db73e379e2e674cd" name="tests/amqpchannel_close.phpt" role="test" />
- <file md5sum="03a9e658a73a31da54220e336bff3181" name="tests/amqpchannel_confirmSelect.phpt" role="test" />
- <file md5sum="d7e3918985d8a12bdf3ce7a9d3211982" name="tests/amqpchannel_construct_basic.phpt" role="test" />
- <file md5sum="beef558370669dd807b3b06c1cad9779" name="tests/amqpchannel_construct_ini_global_prefetch_count.phpt" role="test" />
- <file md5sum="f52b8f3a3ad28f637b8be70de662fa9a" name="tests/amqpchannel_construct_ini_global_prefetch_size.phpt" role="test" />
- <file md5sum="c28bb0faac34c99d55d98833a1e1772b" name="tests/amqpchannel_construct_ini_prefetch_count.phpt" role="test" />
- <file md5sum="b395151f13735bd4a814167ee324845e" name="tests/amqpchannel_construct_ini_prefetch_size.phpt" role="test" />
- <file md5sum="d02be0c301813b1c9a658ee59cc693c5" name="tests/amqpchannel_getChannelId.phpt" role="test" />
- <file md5sum="a88dc9ce8c16911025caf977df508bca" name="tests/amqpchannel_get_connection.phpt" role="test" />
- <file md5sum="2ff44188c4c525c88693240a8503b856" name="tests/amqpchannel_multi_channel_connection.phpt" role="test" />
- <file md5sum="88fd0acaba3a3db2eafc98c31c94a373" name="tests/amqpchannel_set_global_prefetch_count.phpt" role="test" />
- <file md5sum="95b55dcd1c8d5fa5658b0a58bab4779f" name="tests/amqpchannel_set_global_prefetch_size.phpt" role="test" />
- <file md5sum="b2a8ee777346ad1cdbfc25a224d52dee" name="tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt" role="test" />
- <file md5sum="0e424d598022d07c4bb18114e238215c" name="tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt" role="test" />
- <file md5sum="c09f61739a9055b8021c9ee090275401" name="tests/amqpchannel_set_prefetch_count.phpt" role="test" />
- <file md5sum="0a44310a3df53a06a9a9e75062646e47" name="tests/amqpchannel_set_prefetch_size.phpt" role="test" />
- <file md5sum="98fd95b22116dc182d5f5555c31c186c" name="tests/amqpchannel_slots_usage.phpt" role="test" />
- <file md5sum="fdd9b4b224b2230905460316b229616a" name="tests/amqpchannel_validation.phpt" role="test" />
- <file md5sum="14831e6c635d681630d17ea5f6cc8b09" name="tests/amqpchannel_var_dump.phpt" role="test" />
- <file md5sum="36db508382a45e9f94dccae07def37a4" name="tests/amqpconnection_connect_login_failure.phpt" role="test" />
- <file md5sum="bb880c945e4629e341a49d5103b8f656" name="tests/amqpconnection_connection_getters.phpt" role="test" />
- <file md5sum="2f1e1270cb65b55bde87947864ad04d3" name="tests/amqpconnection_construct_basic.phpt" role="test" />
- <file md5sum="eca98180dc00c824a00ee9e49668cdc0" name="tests/amqpconnection_construct_ini_read_timeout.phpt" role="test" />
- <file md5sum="533d19f130617f7ea414461f55a90aa3" name="tests/amqpconnection_construct_ini_timeout.phpt" role="test" />
- <file md5sum="28ef86231f02aec3ecc0d276acb1d7a8" name="tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt" role="test" />
- <file md5sum="a7216c1cd1298d817d5c8276a00ba349" name="tests/amqpconnection_construct_ini_timeout_default.phpt" role="test" />
- <file md5sum="e6debf3d17a67e94ad12d56315945ffd" name="tests/amqpconnection_construct_params_by_value.phpt" role="test" />
- <file md5sum="6f41f721bb3803569945bd4d4d882e4d" name="tests/amqpconnection_construct_with_connect_timeout.phpt" role="test" />
- <file md5sum="520cafe2bd92c63677f5b7e71bb08d63" name="tests/amqpconnection_construct_with_connection_name.phpt" role="test" />
- <file md5sum="efd7c78a371ad8e86d201799448b85c9" name="tests/amqpconnection_construct_with_limits.phpt" role="test" />
- <file md5sum="61b914f14e1307568c672a090b9d748d" name="tests/amqpconnection_construct_with_rpc_timeout.phpt" role="test" />
- <file md5sum="cbabdcccf3d7477d87eaf251c1f92f1f" name="tests/amqpconnection_construct_with_timeout.phpt" role="test" />
- <file md5sum="36a4ea9c9da710ac0fab3d9f6a99672a" name="tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt" role="test" />
- <file md5sum="151c8d3e2191881054dddcda24db497d" name="tests/amqpconnection_construct_with_write_timeout.phpt" role="test" />
- <file md5sum="d3d95b7f42e79edb79d65fe2b9f12a89" name="tests/amqpconnection_getUsedChannels.phpt" role="test" />
- <file md5sum="7b2fcdbba13d322ed6ce709186f8eeb9" name="tests/amqpconnection_heartbeat.phpt" role="test" />
- <file md5sum="ea6429050c45bed39599c2cb19b7c308" name="tests/amqpconnection_heartbeat_with_consumer.phpt" role="test" />
- <file md5sum="61945bde178198573cc0e9846a26474f" name="tests/amqpconnection_heartbeat_with_persistent.phpt" role="test" />
- <file md5sum="5ae30be4fbd4a88129dc770f2511ac23" name="tests/amqpconnection_nullable_setters.phpt" role="test" />
- <file md5sum="7cd51ba24cebb9348ffa837071b3f5ec" name="tests/amqpconnection_persistent_construct_basic.phpt" role="test" />
- <file md5sum="ee72057edfd163ebb713ea2b73791d20" name="tests/amqpconnection_persistent_in_use.phpt" role="test" />
- <file md5sum="23dd9e89397e3e1a81cb862c619816e4" name="tests/amqpconnection_persistent_reusable.phpt" role="test" />
- <file md5sum="65a0b4a1d9807dcf043257e1d4c20b9a" name="tests/amqpconnection_setConnectionName.phpt" role="test" />
- <file md5sum="f45debde302b3c3f0541a53edc1f9e20" name="tests/amqpconnection_setHost.phpt" role="test" />
- <file md5sum="538a67c750067fa39aefa91ffb116860" name="tests/amqpconnection_setLogin.phpt" role="test" />
- <file md5sum="ca5128765494a91a168b1135940d6c66" name="tests/amqpconnection_setPassword.phpt" role="test" />
- <file md5sum="6aff25b6a0757128a8c92d7478d14bf4" name="tests/amqpconnection_setPort_int.phpt" role="test" />
- <file md5sum="bd5817214e3ceac7a11ef55b02e7fdf5" name="tests/amqpconnection_setPort_out_of_range.phpt" role="test" />
- <file md5sum="8762f56dcf85130f6cc4e17a414fc26e" name="tests/amqpconnection_setPort_string.phpt" role="test" />
- <file md5sum="c60fe73cfdeef7d2674067e91400fa44" name="tests/amqpconnection_setReadTimeout_float.phpt" role="test" />
- <file md5sum="9065f4438cbd07c04a1c0698549befeb" name="tests/amqpconnection_setReadTimeout_int.phpt" role="test" />
- <file md5sum="ff2edb88012b5a51de1b2f6d5f7f95f5" name="tests/amqpconnection_setReadTimeout_out_of_range.phpt" role="test" />
- <file md5sum="20fe46987ba67977f38652917bf6c0db" name="tests/amqpconnection_setReadTimeout_string.phpt" role="test" />
- <file md5sum="7607efd3b436dd3b43811320a46642b1" name="tests/amqpconnection_setRpcTimeout_float.phpt" role="test" />
- <file md5sum="57f8c63e2208304e8ff4f7220dad855f" name="tests/amqpconnection_setRpcTimeout_int.phpt" role="test" />
- <file md5sum="e7b675b0046d7ebfcaa5381cc1240b1f" name="tests/amqpconnection_setRpcTimeout_out_of_range.phpt" role="test" />
- <file md5sum="1e06af20018ecc9712efbc4b66b35435" name="tests/amqpconnection_setRpcTimeout_string.phpt" role="test" />
- <file md5sum="cf40b6dea6b5c7731535ba42ccef55e0" name="tests/amqpconnection_setSaslMethod.phpt" role="test" />
- <file md5sum="57bbad386280a4f205daa01682988561" name="tests/amqpconnection_setSaslMethod_invalid.phpt" role="test" />
- <file md5sum="af2bfeaffe6e94c80da0bbb4f6dfd376" name="tests/amqpconnection_setTimeout_deprecated.phpt" role="test" />
- <file md5sum="a2e03f22d11c94ccaee27d13c9e44363" name="tests/amqpconnection_setTimeout_float.phpt" role="test" />
- <file md5sum="49661146a52af67518e8d443d87440fd" name="tests/amqpconnection_setTimeout_int.phpt" role="test" />
- <file md5sum="d2727b7cd560b15945b1819373c0806b" name="tests/amqpconnection_setTimeout_out_of_range.phpt" role="test" />
- <file md5sum="a622f3c1b0c0754cc135e1545cd2c2b5" name="tests/amqpconnection_setTimeout_string.phpt" role="test" />
- <file md5sum="93f8cfd116fce9a8b0fef856866e0dcc" name="tests/amqpconnection_setVhost.phpt" role="test" />
- <file md5sum="cecb4c2b76f79b2bc3868f89a8468239" name="tests/amqpconnection_setWriteTimeout_float.phpt" role="test" />
- <file md5sum="8800dfdc1060adb012c26fb9c82783de" name="tests/amqpconnection_setWriteTimeout_int.phpt" role="test" />
- <file md5sum="2dc2579aa5c71b71b00338ca2f8e91bf" name="tests/amqpconnection_setWriteTimeout_out_of_range.phpt" role="test" />
- <file md5sum="c74b1b0b0e5ed10653db2fdb134c6678" name="tests/amqpconnection_setWriteTimeout_string.phpt" role="test" />
- <file md5sum="998c3ae0533799b84d8d8908b52468ce" name="tests/amqpconnection_tls_basic.phpt" role="test" />
- <file md5sum="7bc0093ba85b1b66785828a37a8fa3fd" name="tests/amqpconnection_tls_mtls.phpt" role="test" />
- <file md5sum="eb7f056a6f664fe9296edaf293d649f7" name="tests/amqpconnection_tls_sasl.phpt" role="test" />
- <file md5sum="82ffd6d27f8eff4a687df1db2b44149f" name="tests/amqpconnection_toomanychannels.phpt" role="test" />
- <file md5sum="13a8852d6a550f6d5f36fbcf854e8304" name="tests/amqpconnection_validation.phpt" role="test" />
- <file md5sum="673d0885df8ba769937be1b588c4bd6b" name="tests/amqpconnection_var_dump.phpt" role="test" />
- <file md5sum="3f42d8b95e09779ac15de08c4b73e102" name="tests/amqpdecimal.phpt" role="test" />
- <file md5sum="34e4e2e3aaf4e8efd66f0e1cb9c4eae5" name="tests/amqpenvelope_construct.phpt" role="test" />
- <file md5sum="c13f4f279606c442bb6181dbd064b743" name="tests/amqpenvelope_get_accessors.phpt" role="test" />
- <file md5sum="676627907a877455246804538ec91595" name="tests/amqpenvelope_var_dump.phpt" role="test" />
- <file md5sum="d669afd2e8fb05f457abaab85241dda1" name="tests/amqpexchange-declare-segfault.phpt" role="test" />
- <file md5sum="26d3bc1964879cd5bbd795939150efef" name="tests/amqpexchange_attributes.phpt" role="test" />
- <file md5sum="11d937b51693887c06f2aafc38061063" name="tests/amqpexchange_bind.phpt" role="test" />
- <file md5sum="222db8c18807297723e97b15e06f5bdf" name="tests/amqpexchange_bind_with_arguments.phpt" role="test" />
- <file md5sum="6854c577135b5fe8e6eaba947b02aa44" name="tests/amqpexchange_bind_without_key.phpt" role="test" />
- <file md5sum="3ae10299bfdf46498e3956ed76854ce2" name="tests/amqpexchange_bind_without_key_with_arguments.phpt" role="test" />
- <file md5sum="88379a3ac67ac7779d0a965a21678c1a" name="tests/amqpexchange_channel_refcount.phpt" role="test" />
- <file md5sum="6b1d9edcced270b00eebc5100346489f" name="tests/amqpexchange_construct_basic.phpt" role="test" />
- <file md5sum="d215b732ba92a793109f39bebab00832" name="tests/amqpexchange_declare_basic.phpt" role="test" />
- <file md5sum="2e519c5f860cc1c8c312b8d64424adfd" name="tests/amqpexchange_declare_existent.phpt" role="test" />
- <file md5sum="3886df40a26aa4abebd1d93e6d15bb11" name="tests/amqpexchange_declare_with_stalled_reference.phpt" role="test" />
- <file md5sum="e02058b30b961a8c38b79bb4a0ace2cf" name="tests/amqpexchange_declare_without_name.phpt" role="test" />
- <file md5sum="8a61660efd6a7e138600233626eee72b" name="tests/amqpexchange_declare_without_type.phpt" role="test" />
- <file md5sum="8c38cf4356f2ce2cd2a1c24ab3a2cddc" name="tests/amqpexchange_delete_default_exchange.phpt" role="test" />
- <file md5sum="b80bb01ed155ecbe5c42e967ee51de7e" name="tests/amqpexchange_delete_null_name.phpt" role="test" />
- <file md5sum="ea6d19919233a510006efe1c022c0e43" name="tests/amqpexchange_get_channel.phpt" role="test" />
- <file md5sum="414115dafa4f847fcc48d387c6020efc" name="tests/amqpexchange_get_connection.phpt" role="test" />
- <file md5sum="f332817bd09dad9c6b8859f4af00d4ee" name="tests/amqpexchange_invalid_type.phpt" role="test" />
- <file md5sum="1367b8c18a7704f407b221b95199c83d" name="tests/amqpexchange_name.phpt" role="test" />
- <file md5sum="82bf77bed018031f6556ccdbe57ce005" name="tests/amqpexchange_publish_basic.phpt" role="test" />
- <file md5sum="cfbe1c99497857fb3ba6e5252e06645b" name="tests/amqpexchange_publish_confirms.phpt" role="test" />
- <file md5sum="81d087832493caaf5b21b9c033d1a360" name="tests/amqpexchange_publish_confirms_consume.phpt" role="test" />
- <file md5sum="6da33c6115e66f85cb43065751dfcf01" name="tests/amqpexchange_publish_empty_routing_key.phpt" role="test" />
- <file md5sum="4050f144b4803f373a3106210273a7f6" name="tests/amqpexchange_publish_mandatory.phpt" role="test" />
- <file md5sum="41e4f0dd2a666f1ff5f4b02164b6d2ee" name="tests/amqpexchange_publish_mandatory_consume.phpt" role="test" />
- <file md5sum="d7d82989b09e2a10ad6842f01db89598" name="tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt" role="test" />
- <file md5sum="a5d7fadef2ab40be87ba69cd08bce5d5" name="tests/amqpexchange_publish_null_routing_key.phpt" role="test" />
- <file md5sum="7082cc7becbdc70e782cdcba3dc9a36c" name="tests/amqpexchange_publish_with_decimal_header.phpt" role="test" />
- <file md5sum="a77906071feea6d9ee3256597f792593" name="tests/amqpexchange_publish_with_null.phpt" role="test" />
- <file md5sum="02f58d2059cba80b07490fd6493325dd" name="tests/amqpexchange_publish_with_properties.phpt" role="test" />
- <file md5sum="3650afe1ff9471516916e8ce1bcf547b" name="tests/amqpexchange_publish_with_properties_ignore_num_header.phpt" role="test" />
- <file md5sum="a8d84ae9a9e917e390974f3f3291ed45" name="tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt" role="test" />
- <file md5sum="5e90254a2fb0bc10086541b6c4d623e3" name="tests/amqpexchange_publish_with_properties_nested_header.phpt" role="test" />
- <file md5sum="aa128b96880eb9d26c7624a2ac5b14e0" name="tests/amqpexchange_publish_with_properties_user_id_failure.phpt" role="test" />
- <file md5sum="b08ecbd674c25d9d41d05359e222a4d5" name="tests/amqpexchange_publish_with_timestamp_header.phpt" role="test" />
- <file md5sum="e99584ca4835d836aed2a7c138f2e494" name="tests/amqpexchange_publish_xdeath.phpt" role="test" />
- <file md5sum="a1ee683d69ba5d1a13bcf1190dbd5514" name="tests/amqpexchange_setArgument.phpt" role="test" />
- <file md5sum="7ee2d28174cd47bc750f0e2158739890" name="tests/amqpexchange_set_flag.phpt" role="test" />
- <file md5sum="e7696d543f1d44bec6e934a2658c59a4" name="tests/amqpexchange_set_flags.phpt" role="test" />
- <file md5sum="bdf7f2faade61ead480d82d3b274c03a" name="tests/amqpexchange_type.phpt" role="test" />
- <file md5sum="fa8a63cd95367b63e89f2f4c6ae61312" name="tests/amqpexchange_unbind.phpt" role="test" />
- <file md5sum="07bc2d1e412c1e72bee2ce78db5c77e4" name="tests/amqpexchange_unbind_with_arguments.phpt" role="test" />
- <file md5sum="993fd0d23f87b01e557f4b7804047c34" name="tests/amqpexchange_unbind_without_key.phpt" role="test" />
- <file md5sum="75331236ae90d112f4506289314e818d" name="tests/amqpexchange_unbind_without_key_with_arguments.phpt" role="test" />
- <file md5sum="b9000af24cd9164fe72746ab452f3c40" name="tests/amqpexchange_var_dump.phpt" role="test" />
- <file md5sum="e501cc834d1dcd0bfe59da7e7948d00e" name="tests/amqpqueue-cancel-no-consumers.phpt" role="test" />
- <file md5sum="dae417925ff2fe53d8cd14d2ba93094a" name="tests/amqpqueue_attributes.phpt" role="test" />
- <file md5sum="c0f1f64545ffb1e2aff0cbc33364431e" name="tests/amqpqueue_bind_basic.phpt" role="test" />
- <file md5sum="17b7effafd98a438a92deb0adf2da29c" name="tests/amqpqueue_bind_basic_empty_routing_key.phpt" role="test" />
- <file md5sum="6c30ee8955dcc4ed5d32d6995bf951b7" name="tests/amqpqueue_bind_basic_headers_arguments.phpt" role="test" />
- <file md5sum="27dda0d5e1127e7f1856a95e92617160" name="tests/amqpqueue_bind_null_routing_key.phpt" role="test" />
- <file md5sum="3d23be4471bf7d459ea8ba043c71eb27" name="tests/amqpqueue_cancel.phpt" role="test" />
- <file md5sum="ff411efc7c7d675b302a28ccb11ad0ec" name="tests/amqpqueue_construct_basic.phpt" role="test" />
- <file md5sum="378ff8e86e36677d8d63da0dbdb3a368" name="tests/amqpqueue_consume_basic.phpt" role="test" />
- <file md5sum="f4cac3d7fc7238426f4ee722006e0b20" name="tests/amqpqueue_consume_multiple.phpt" role="test" />
- <file md5sum="47b27e42c1c5e637392a79a85cdcfd39" name="tests/amqpqueue_consume_multiple_no_doubles.phpt" role="test" />
- <file md5sum="904f050b8f74cb85ace4d20556eccc08" name="tests/amqpqueue_consume_nonexistent.phpt" role="test" />
- <file md5sum="c82bb0b5ab6a6f99d3f458107d56d648" name="tests/amqpqueue_consume_null_consumer_key.phpt" role="test" />
- <file md5sum="3c1ca9f0ad7c3015626dc3850279bd93" name="tests/amqpqueue_consume_timeout.phpt" role="test" />
- <file md5sum="ff11af9c2ee9885eca0fa7d3ddb8b9b5" name="tests/amqpqueue_declare_basic.phpt" role="test" />
- <file md5sum="1c242f0204906205d0697fb1df13521d" name="tests/amqpqueue_declare_with_arguments.phpt" role="test" />
- <file md5sum="ae0d71b01c9dc6fbcc1b23041c29df16" name="tests/amqpqueue_declare_with_stalled_reference.phpt" role="test" />
- <file md5sum="eea5ed60d0ce3b2dfdc750031b5617ff" name="tests/amqpqueue_delete_basic.phpt" role="test" />
- <file md5sum="b61d257c266cf2824c2ea51b66901dfa" name="tests/amqpqueue_empty_name.phpt" role="test" />
- <file md5sum="1b542e3cbd9dd4158a53163b24386dba" name="tests/amqpqueue_get_basic.phpt" role="test" />
- <file md5sum="a9d960f929758bde3873b10cd259e507" name="tests/amqpqueue_get_channel.phpt" role="test" />
- <file md5sum="d3d0ae7fc12aaea97acb5f6fd8dd42e8" name="tests/amqpqueue_get_connection.phpt" role="test" />
- <file md5sum="9ce1d39c8c0ab01bc50af7d56ea20bd6" name="tests/amqpqueue_get_empty_body.phpt" role="test" />
- <file md5sum="bcea50b2a5f624325b012d5c352c82c9" name="tests/amqpqueue_get_headers.phpt" role="test" />
- <file md5sum="cadd44bce34247d2982c292782b70d99" name="tests/amqpqueue_get_nonexistent.phpt" role="test" />
- <file md5sum="01b3f9a5c6eff170504ce4fe9827f2db" name="tests/amqpqueue_headers_with_bool.phpt" role="test" />
- <file md5sum="2907ecd0eb5bb3c16f5dc8e76caad2bb" name="tests/amqpqueue_headers_with_float.phpt" role="test" />
- <file md5sum="4dcaed80350ab0ba38c66a116ad02787" name="tests/amqpqueue_headers_with_null.phpt" role="test" />
- <file md5sum="8e0c12535ed0607e0bcbef91d5d72e24" name="tests/amqpqueue_nack.phpt" role="test" />
- <file md5sum="3b5c0e5e1602ef59fda481a7ff694cf0" name="tests/amqpqueue_nested_arrays.phpt" role="test" />
- <file md5sum="a25b2d03317577199455a94930173c2a" name="tests/amqpqueue_nested_headers.phpt" role="test" />
- <file md5sum="2dac510fd66286e187b2d77e009087bb" name="tests/amqpqueue_purge_basic.phpt" role="test" />
- <file md5sum="e7ba06de93be6be59b0c63c7300cc936" name="tests/amqpqueue_recover.phpt" role="test" />
- <file md5sum="15a805d2415803497e505b30b6740aef" name="tests/amqpqueue_setArgument.phpt" role="test" />
- <file md5sum="bc6332bbde48e810c1c6ced5694fc8d5" name="tests/amqpqueue_setFlags.phpt" role="test" />
- <file md5sum="ae04f1ac0fe11f8119c2540e5f260430" name="tests/amqpqueue_unbind_basic_empty_routing_key.phpt" role="test" />
- <file md5sum="dbe7978e064d9fa76605d02cc2e94601" name="tests/amqpqueue_unbind_basic_headers_arguments.phpt" role="test" />
- <file md5sum="79288ddee5080cc581f8cdd53bbcb9c7" name="tests/amqpqueue_var_dump.phpt" role="test" />
- <file md5sum="ac875c7b0e00a07f048009d5bea87b67" name="tests/amqptimestamp.phpt" role="test" />
- <file md5sum="ca747b05bd91e8b51d796d952b734ace" name="tests/bug_17831.phpt" role="test" />
- <file md5sum="1b10183fad5ccea9ed4c9eb793a08559" name="tests/bug_19707.phpt" role="test" />
- <file md5sum="890bab35e5fc7e1ce5422d160b34c110" name="tests/bug_19840.phpt" role="test" />
- <file md5sum="f36dd1d0fb15b7cb97f45ea8790578e2" name="tests/bug_351.phpt" role="test" />
- <file md5sum="defe2e25270001426f6aa6addeb19fad" name="tests/bug_385.phpt" role="test" />
- <file md5sum="58d3e34cfc6d4228a580d62e9c444678" name="tests/bug_61533.phpt" role="test" />
- <file md5sum="fa90a17e659c0cfa0371f39e58394767" name="tests/bug_62354.phpt" role="test" />
- <file md5sum="a259da8fb08a8ae9111f810210f938df" name="tests/bug_gh147.phpt" role="test" />
- <file md5sum="16add262fad6045e74eaf193ce316410" name="tests/bug_gh155_direct_reply_to.phpt" role="test" />
- <file md5sum="2b53f0dfe1600609b53f4b6b980aeb8f" name="tests/bug_gh50-1.phpt" role="test" />
- <file md5sum="c285c3d99a3784c12d1bda75f20b217a" name="tests/bug_gh50-2.phpt" role="test" />
- <file md5sum="c802f4632f542bddef9fd9578d66c866" name="tests/bug_gh50-3.phpt" role="test" />
- <file md5sum="87fcaa6d7de40599ed3a02e61905f84d" name="tests/bug_gh50-4.phpt" role="test" />
- <file md5sum="1612a504686bcb560e5ba841bdf379fe" name="tests/bug_gh53-2.phpt" role="test" />
- <file md5sum="ed8ce08df960bb626dfb9e08c187832f" name="tests/bug_gh53.phpt" role="test" />
- <file md5sum="708d72cd0a9a91311dea3857e0470642" name="tests/bug_gh72-1.phpt" role="test" />
- <file md5sum="e07f7eefca1d55283da60da4180b2c79" name="tests/bug_gh72-2.phpt" role="test" />
- <file md5sum="49a8ea25dfba3e16587ce18a9c9a277b" name="tests/ini_validation_failure.phpt" role="test" />
- <file md5sum="7969fc6ed108aafdd8aeb501342c092e" name="tests/package-version.phpt" role="test" />
- <file md5sum="b75d62851b952c83bcaa5dbf75d6471d" name="tests/serialize-custom-amqpvalue-errors.phpt" role="test" />
- <file md5sum="2a95c65a83ff7057e4cc9d00458ee053" name="tests/serialize-custom-amqpvalue.phpt" role="test" />
- <file md5sum="e2aa659197336152306266db1b484007" name="tests/testtest.phpt" role="test" />
+ <file md5sum="e733716ddaf955fbf55eb1d1f108d0ef" name="php_amqp.h" role="src" />
+ <file md5sum="59363896174f831e1eb480db8036db36" name="php_amqp_version.h" role="src" />
+ <file md5sum="6c277ddea5f162593a350963525d045b" name="tests/003-channel-consumers.phpt" role="test" />
+ <file md5sum="e86c82e889aa89ba1c4d4764497d1320" name="tests/004-queue-consume-nested.phpt" role="test" />
+ <file md5sum="0f7e60d7b309f2d68934878c2151f827" name="tests/004-queue-consume-orphaned.phpt" role="test" />
+ <file md5sum="6b3e06309faac4c9b307db99418a1df0" name="tests/amqp_version.phpt" role="test" />
+ <file md5sum="afa38eab8996dc51678a38905a1484ba" name="tests/amqpbasicproperties.phpt" role="test" />
+ <file md5sum="d9a20c6ff671cd59005e762203bcbed6" name="tests/amqpchannel_basicRecover.phpt" role="test" />
+ <file md5sum="d766344c7a60ed3b6e38564d961c9166" name="tests/amqpchannel_close.phpt" role="test" />
+ <file md5sum="616d8008fa9dc15ba58931eae9672be5" name="tests/amqpchannel_confirmSelect.phpt" role="test" />
+ <file md5sum="fa26ab175aa4a4d767037c26c31d5fd3" name="tests/amqpchannel_construct_basic.phpt" role="test" />
+ <file md5sum="7c72fc21c72394df5a170114b169d8c2" name="tests/amqpchannel_construct_ini_global_prefetch_count.phpt" role="test" />
+ <file md5sum="cbfd07f397262480c8ce4a517e636b04" name="tests/amqpchannel_construct_ini_global_prefetch_size.phpt" role="test" />
+ <file md5sum="9646eaeef91c73f5f5b671871f85aff2" name="tests/amqpchannel_construct_ini_prefetch_count.phpt" role="test" />
+ <file md5sum="663f2fde7fd30f5f32ada4ac2e41a34c" name="tests/amqpchannel_construct_ini_prefetch_size.phpt" role="test" />
+ <file md5sum="3259a24140aec691350b6a5197994ee0" name="tests/amqpchannel_getChannelId.phpt" role="test" />
+ <file md5sum="537155531eb43fc16d8982496aa9bcea" name="tests/amqpchannel_get_connection.phpt" role="test" />
+ <file md5sum="bcb0eb8885402d22d12ff3b2ad425182" name="tests/amqpchannel_multi_channel_connection.phpt" role="test" />
+ <file md5sum="3587efac214dd41df7d20c87493cfbdc" name="tests/amqpchannel_set_global_prefetch_count.phpt" role="test" />
+ <file md5sum="59db75737bbc0ef671d64763ae18dfbc" name="tests/amqpchannel_set_global_prefetch_size.phpt" role="test" />
+ <file md5sum="c964ac10884996081c59332458ab99f5" name="tests/amqpchannel_set_prefetch_and_global_prefetch_count.phpt" role="test" />
+ <file md5sum="ebc518c106177e6c89d53746aba96e76" name="tests/amqpchannel_set_prefetch_and_global_prefetch_size.phpt" role="test" />
+ <file md5sum="6b74d232b906d7b74d97a45def5ca197" name="tests/amqpchannel_set_prefetch_count.phpt" role="test" />
+ <file md5sum="8f193e1e322b0fba57fdacf52decb112" name="tests/amqpchannel_set_prefetch_size.phpt" role="test" />
+ <file md5sum="0c0b36cb9d223ebb968c833bd89d5e74" name="tests/amqpchannel_slots_usage.phpt" role="test" />
+ <file md5sum="a1e765ef7b003db5d6752ac8ff0f412a" name="tests/amqpchannel_validation.phpt" role="test" />
+ <file md5sum="9f03b8575d77127d863121d3b2ee8bbb" name="tests/amqpchannel_var_dump.phpt" role="test" />
+ <file md5sum="afb5fc2ce2f214256ea495397c672b6c" name="tests/amqpconnection_connect_login_failure.phpt" role="test" />
+ <file md5sum="b9f639c445d037396a505e7edb78b645" name="tests/amqpconnection_connection_getters.phpt" role="test" />
+ <file md5sum="858c904ca0d66c2f826dcdd4e27cd161" name="tests/amqpconnection_construct_basic.phpt" role="test" />
+ <file md5sum="21d9ac61888960b7c867d6b4c017ec42" name="tests/amqpconnection_construct_ini_read_timeout.phpt" role="test" />
+ <file md5sum="e8e5fa0b53702da8bfb1c477450fefb9" name="tests/amqpconnection_construct_ini_timeout.phpt" role="test" />
+ <file md5sum="60fa906606d023c77abba0e7c6a85abf" name="tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt" role="test" />
+ <file md5sum="2920938cdde6d5fdad97d5ea3053b6c8" name="tests/amqpconnection_construct_ini_timeout_default.phpt" role="test" />
+ <file md5sum="114b5fd372e6b12db3bbd457eb68863e" name="tests/amqpconnection_construct_params_by_value.phpt" role="test" />
+ <file md5sum="23c54a12d56410edc3b10926aa770ce3" name="tests/amqpconnection_construct_with_connect_timeout.phpt" role="test" />
+ <file md5sum="5c3558b851cf8939e83ec51522240220" name="tests/amqpconnection_construct_with_connection_name.phpt" role="test" />
+ <file md5sum="84bd93007fb6920b8ba58b85c8969398" name="tests/amqpconnection_construct_with_limits.phpt" role="test" />
+ <file md5sum="ca12a037ec9f64aa50d8936d2cb68a9f" name="tests/amqpconnection_construct_with_rpc_timeout.phpt" role="test" />
+ <file md5sum="892ff6de58bb78e38edcfaaaa5c32831" name="tests/amqpconnection_construct_with_timeout.phpt" role="test" />
+ <file md5sum="3121e4088ed39c014a8694e4bd9a3730" name="tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt" role="test" />
+ <file md5sum="7aed13874bfdad0b02a0fd2af2d6ea93" name="tests/amqpconnection_construct_with_verify_false.phpt" role="test" />
+ <file md5sum="79e8dd91a18209d9f6c1cc34edad688d" name="tests/amqpconnection_construct_with_write_timeout.phpt" role="test" />
+ <file md5sum="866866de0c313fa1b0f85c88cdb714da" name="tests/amqpconnection_getUsedChannels.phpt" role="test" />
+ <file md5sum="0b49bc6ec7a572f6dfa78ef827ba7e4a" name="tests/amqpconnection_heartbeat.phpt" role="test" />
+ <file md5sum="919a51db8e84ee790ed0123355ca13c1" name="tests/amqpconnection_heartbeat_with_consumer.phpt" role="test" />
+ <file md5sum="67ce104d02087ffbfe479fbf5146674d" name="tests/amqpconnection_heartbeat_with_persistent.phpt" role="test" />
+ <file md5sum="c265035370858b18f008438b723ca26e" name="tests/amqpconnection_nullable_setters.phpt" role="test" />
+ <file md5sum="8535e486d750c1ed6368b9b116a640f6" name="tests/amqpconnection_persistent_construct_basic.phpt" role="test" />
+ <file md5sum="77b290e12c25fcfee99898794f3175a5" name="tests/amqpconnection_persistent_in_use.phpt" role="test" />
+ <file md5sum="876226fc55711234d9cfea80ea54f082" name="tests/amqpconnection_persistent_reusable.phpt" role="test" />
+ <file md5sum="95a6fa170bf1d989a5d95e0601a5f2af" name="tests/amqpconnection_setConnectionName.phpt" role="test" />
+ <file md5sum="c094b923113a70120d65d5c89421258b" name="tests/amqpconnection_setHost.phpt" role="test" />
+ <file md5sum="ac3e0cfef176906dec899b8a47badc01" name="tests/amqpconnection_setLogin.phpt" role="test" />
+ <file md5sum="3d81ab561f24acc63d31a13afc3cc2a6" name="tests/amqpconnection_setPassword.phpt" role="test" />
+ <file md5sum="674ec59e649ac7afd89716594df2d7d4" name="tests/amqpconnection_setPort_int.phpt" role="test" />
+ <file md5sum="b72b67649f568b206d0b9bf4cd8c6279" name="tests/amqpconnection_setPort_out_of_range.phpt" role="test" />
+ <file md5sum="84c946df0d6ba3b1c1bd090bd1eaa2c3" name="tests/amqpconnection_setPort_string.phpt" role="test" />
+ <file md5sum="2368298280d7f4c5a8f71803e08ee95d" name="tests/amqpconnection_setReadTimeout_float.phpt" role="test" />
+ <file md5sum="fb56a787339fe1ac52cd9f82bb306194" name="tests/amqpconnection_setReadTimeout_int.phpt" role="test" />
+ <file md5sum="72630c73b14fb80dbb037db568244582" name="tests/amqpconnection_setReadTimeout_out_of_range.phpt" role="test" />
+ <file md5sum="b527b55c90dbf806c7514c9a5ce21eee" name="tests/amqpconnection_setReadTimeout_string.phpt" role="test" />
+ <file md5sum="5db1d1d43369af74f98737d3507aa3bd" name="tests/amqpconnection_setRpcTimeout_float.phpt" role="test" />
+ <file md5sum="1cafca13078edd742db6a1fdeaf870ab" name="tests/amqpconnection_setRpcTimeout_int.phpt" role="test" />
+ <file md5sum="14fa872933c91f18144714ce7bbc90fa" name="tests/amqpconnection_setRpcTimeout_out_of_range.phpt" role="test" />
+ <file md5sum="79ea18bd82afa93815c093a72342ad56" name="tests/amqpconnection_setRpcTimeout_string.phpt" role="test" />
+ <file md5sum="cc6643c5becf45bf35a849097a299b21" name="tests/amqpconnection_setSaslMethod.phpt" role="test" />
+ <file md5sum="1a1b486a950a3fb82175f7214ae95869" name="tests/amqpconnection_setSaslMethod_invalid.phpt" role="test" />
+ <file md5sum="0d94e9c020626af9a4ff0f0fa624bc17" name="tests/amqpconnection_setTimeout_deprecated.phpt" role="test" />
+ <file md5sum="bbcda2416977ff40600aa69557304935" name="tests/amqpconnection_setTimeout_float.phpt" role="test" />
+ <file md5sum="a54f1f3388ec6d0f55643246db455fc1" name="tests/amqpconnection_setTimeout_int.phpt" role="test" />
+ <file md5sum="ac16b7c473684623b0bef6141af71e26" name="tests/amqpconnection_setTimeout_out_of_range.phpt" role="test" />
+ <file md5sum="3453d4b5fa3b396b6df85cf95ff764e7" name="tests/amqpconnection_setTimeout_string.phpt" role="test" />
+ <file md5sum="fca683df5845cb78fa58e4401a95c2e9" name="tests/amqpconnection_setVhost.phpt" role="test" />
+ <file md5sum="24b2f202025d0025194fc485036207d2" name="tests/amqpconnection_setWriteTimeout_float.phpt" role="test" />
+ <file md5sum="1a56d24ccbf075bce1b86d90920ecae9" name="tests/amqpconnection_setWriteTimeout_int.phpt" role="test" />
+ <file md5sum="fdc2f6ed57fd907f3a109926796c3a0d" name="tests/amqpconnection_setWriteTimeout_out_of_range.phpt" role="test" />
+ <file md5sum="11c0e0470ac178fadb84f27bcf555515" name="tests/amqpconnection_setWriteTimeout_string.phpt" role="test" />
+ <file md5sum="1656942fa353d9a37a6f6e45553ec74c" name="tests/amqpconnection_tls_basic.phpt" role="test" />
+ <file md5sum="26e10224e9935e50a1e59de8da73b834" name="tests/amqpconnection_tls_mtls.phpt" role="test" />
+ <file md5sum="a28561b635ad3d4981609326ba29e048" name="tests/amqpconnection_tls_sasl.phpt" role="test" />
+ <file md5sum="2691dac3f026888d39dfafc189539dda" name="tests/amqpconnection_toomanychannels.phpt" role="test" />
+ <file md5sum="03eae8ff9214952ce3961d146ef74fc9" name="tests/amqpconnection_validation.phpt" role="test" />
+ <file md5sum="6610444a11e540d37318bbf341bd331f" name="tests/amqpconnection_var_dump.phpt" role="test" />
+ <file md5sum="b9bf42bb79a0810154659db1f057790d" name="tests/amqpdecimal.phpt" role="test" />
+ <file md5sum="ebaa5f604af17ab4f664744a1ba272fe" name="tests/amqpenvelope_construct.phpt" role="test" />
+ <file md5sum="1feaeaaf2b11cd1d636d06e6c63041a4" name="tests/amqpenvelope_get_accessors.phpt" role="test" />
+ <file md5sum="4235c8b4f2a6f1d23d24f60ba8a0b4e8" name="tests/amqpenvelope_var_dump.phpt" role="test" />
+ <file md5sum="27bb21540283f7be9e5e6fff6f590b52" name="tests/amqpexchange-declare-segfault.phpt" role="test" />
+ <file md5sum="cb063241109e8dcc562da951af9b622e" name="tests/amqpexchange_attributes.phpt" role="test" />
+ <file md5sum="6c1e4f74211a4cc1ed62d5d9eca1cebf" name="tests/amqpexchange_bind.phpt" role="test" />
+ <file md5sum="7b62a2c67e616d87c4daadc93e52f620" name="tests/amqpexchange_bind_with_arguments.phpt" role="test" />
+ <file md5sum="e7818e63541a762bc28f7c59c129a121" name="tests/amqpexchange_bind_without_key.phpt" role="test" />
+ <file md5sum="c402e62a0b89f8e8018216cdba3b720d" name="tests/amqpexchange_bind_without_key_with_arguments.phpt" role="test" />
+ <file md5sum="3c90c41519baa40cda1df09415e7fb30" name="tests/amqpexchange_channel_refcount.phpt" role="test" />
+ <file md5sum="103a8844c0c971f1dbeab4f7d8d26f3c" name="tests/amqpexchange_construct_basic.phpt" role="test" />
+ <file md5sum="11f9b38a351a6f2c152a8e1979bf27fe" name="tests/amqpexchange_declare_basic.phpt" role="test" />
+ <file md5sum="548a2103b2280ea92e3c39e3688449aa" name="tests/amqpexchange_declare_existent.phpt" role="test" />
+ <file md5sum="03037735ed44042396c5307aa59ed718" name="tests/amqpexchange_declare_with_stalled_reference.phpt" role="test" />
+ <file md5sum="3a078f0482a03f49e43e38f9a886f409" name="tests/amqpexchange_declare_without_name.phpt" role="test" />
+ <file md5sum="2f1ed1bf1a611a17a0b37cd5131bb66c" name="tests/amqpexchange_declare_without_type.phpt" role="test" />
+ <file md5sum="74856c199cc860a445bcbdd709f5c63d" name="tests/amqpexchange_delete_default_exchange.phpt" role="test" />
+ <file md5sum="c93542b6402eeadb6bdc99620ce837e5" name="tests/amqpexchange_delete_null_name.phpt" role="test" />
+ <file md5sum="c195a0d9ae239b9e78601699492e2370" name="tests/amqpexchange_get_channel.phpt" role="test" />
+ <file md5sum="d4c2966458d35284265ba064bf1c88b2" name="tests/amqpexchange_get_connection.phpt" role="test" />
+ <file md5sum="8cc528eacb62759352b39fa0796300dc" name="tests/amqpexchange_invalid_type.phpt" role="test" />
+ <file md5sum="3da3ef1cf1987419928032b9b9848234" name="tests/amqpexchange_name.phpt" role="test" />
+ <file md5sum="6b1431b643d05188484240d9f0cee4b2" name="tests/amqpexchange_publish_basic.phpt" role="test" />
+ <file md5sum="3840ccb29762a15b533bbbea7c344ac4" name="tests/amqpexchange_publish_confirms.phpt" role="test" />
+ <file md5sum="853e270a1122ee2cc2ae80d05f559b4d" name="tests/amqpexchange_publish_confirms_consume.phpt" role="test" />
+ <file md5sum="b3f3d0ad39bb9d6ccb059e6ed5ffa82c" name="tests/amqpexchange_publish_empty_routing_key.phpt" role="test" />
+ <file md5sum="2ee55f56f7807a69bd55d340599cb03d" name="tests/amqpexchange_publish_mandatory.phpt" role="test" />
+ <file md5sum="d77cd35094fa55ef84ce765444138303" name="tests/amqpexchange_publish_mandatory_consume.phpt" role="test" />
+ <file md5sum="de2b0d656651dc45711499f49e65e642" name="tests/amqpexchange_publish_mandatory_multiple_channels_pitfall.phpt" role="test" />
+ <file md5sum="3620643e19558c67068a41a648623b7a" name="tests/amqpexchange_publish_null_routing_key.phpt" role="test" />
+ <file md5sum="5c2eb4a14c990fa9e8e90ac66b8a93aa" name="tests/amqpexchange_publish_with_decimal_header.phpt" role="test" />
+ <file md5sum="4ec4bb69dba1a85bc568278c6e399223" name="tests/amqpexchange_publish_with_null.phpt" role="test" />
+ <file md5sum="c11c3b9152796fd0303f52c02c2ee3fc" name="tests/amqpexchange_publish_with_properties.phpt" role="test" />
+ <file md5sum="374f8f720f0c75dd0dd6524e3fb3d08e" name="tests/amqpexchange_publish_with_properties_ignore_num_header.phpt" role="test" />
+ <file md5sum="466bbced80f8dc1197b346ffb9b0cf06" name="tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt" role="test" />
+ <file md5sum="ebf14f2ec50e457bf321f69da3f6ada7" name="tests/amqpexchange_publish_with_properties_nested_header.phpt" role="test" />
+ <file md5sum="2b7f62472392e216e055f860b7c41c0a" name="tests/amqpexchange_publish_with_properties_user_id_failure.phpt" role="test" />
+ <file md5sum="47cc72b4ea100f46e090df837c520fe8" name="tests/amqpexchange_publish_with_timestamp_header.phpt" role="test" />
+ <file md5sum="d509d980da6233a48f601ff3105c801f" name="tests/amqpexchange_publish_xdeath.phpt" role="test" />
+ <file md5sum="33dd2c27df1b7ce42f8d32c5ad775094" name="tests/amqpexchange_setArgument.phpt" role="test" />
+ <file md5sum="693e2200a58dcba41931b892696aab1d" name="tests/amqpexchange_set_flag.phpt" role="test" />
+ <file md5sum="aa0ee96e29fabc843e2b4e0a771e04cb" name="tests/amqpexchange_set_flags.phpt" role="test" />
+ <file md5sum="a4b64f1594d674743e51b2465b5795cc" name="tests/amqpexchange_type.phpt" role="test" />
+ <file md5sum="f1a580d1c3729fcc1ded22e50296e1b2" name="tests/amqpexchange_unbind.phpt" role="test" />
+ <file md5sum="9619e95417f716214100068e4b2a01a6" name="tests/amqpexchange_unbind_with_arguments.phpt" role="test" />
+ <file md5sum="e02f0e1fa5062ca89c4cebd7ff952355" name="tests/amqpexchange_unbind_without_key.phpt" role="test" />
+ <file md5sum="56c45ddff3f5ff695e31b7797d676a35" name="tests/amqpexchange_unbind_without_key_with_arguments.phpt" role="test" />
+ <file md5sum="60a19dd3216847aa8a9c844656a6c583" name="tests/amqpexchange_var_dump.phpt" role="test" />
+ <file md5sum="1a9ff26be9a59b01af06c2891a891c89" name="tests/amqpqueue-cancel-no-consumers.phpt" role="test" />
+ <file md5sum="e93aec0c5fec6ff7a489414f52af7506" name="tests/amqpqueue_attributes.phpt" role="test" />
+ <file md5sum="3c57aec5a79b707cad455efe4bce5522" name="tests/amqpqueue_bind_basic.phpt" role="test" />
+ <file md5sum="907233092b7596e4602fb4649ba3dd39" name="tests/amqpqueue_bind_basic_empty_routing_key.phpt" role="test" />
+ <file md5sum="17ce421379646e4bfd9158d8ddf14ef3" name="tests/amqpqueue_bind_basic_headers_arguments.phpt" role="test" />
+ <file md5sum="27455490e5e82aae65797cff8f1ee2aa" name="tests/amqpqueue_bind_null_routing_key.phpt" role="test" />
+ <file md5sum="13422ed35375bb8e84075e70c091c524" name="tests/amqpqueue_cancel.phpt" role="test" />
+ <file md5sum="1828327be8d09c7a66b66287b6067d7d" name="tests/amqpqueue_construct_basic.phpt" role="test" />
+ <file md5sum="80359e190459349d56be711e507e3f3d" name="tests/amqpqueue_consume_basic.phpt" role="test" />
+ <file md5sum="c565c19f46ec82b76004898140fc1ead" name="tests/amqpqueue_consume_multiple.phpt" role="test" />
+ <file md5sum="4d990869c9d3eb150e5c46b8feef0639" name="tests/amqpqueue_consume_multiple_no_doubles.phpt" role="test" />
+ <file md5sum="4abbfa4ab2187e7b168d22b1ed35677b" name="tests/amqpqueue_consume_nonexistent.phpt" role="test" />
+ <file md5sum="02824f67895aef74e3a66bfb8723bc64" name="tests/amqpqueue_consume_null_consumer_key.phpt" role="test" />
+ <file md5sum="2a4db68504d43bac92c767a32662be89" name="tests/amqpqueue_consume_timeout.phpt" role="test" />
+ <file md5sum="f49f1657e47cf7e780695607ed2d1ebc" name="tests/amqpqueue_declare_basic.phpt" role="test" />
+ <file md5sum="dc7b7aec1898a80f61096dfe8c7942d3" name="tests/amqpqueue_declare_with_arguments.phpt" role="test" />
+ <file md5sum="a11610419ff5836ce3af3e3f7238f313" name="tests/amqpqueue_declare_with_stalled_reference.phpt" role="test" />
+ <file md5sum="10d102e165bb78164acce9c3eb6c78ec" name="tests/amqpqueue_delete_basic.phpt" role="test" />
+ <file md5sum="9f5bc4895f62187cc87307500a128588" name="tests/amqpqueue_empty_name.phpt" role="test" />
+ <file md5sum="badecc648953adede73f24cd9510d6df" name="tests/amqpqueue_get_basic.phpt" role="test" />
+ <file md5sum="fa7e42c8469a3e7884e2a6ea34038455" name="tests/amqpqueue_get_channel.phpt" role="test" />
+ <file md5sum="bd4e8af751597726407493f096277670" name="tests/amqpqueue_get_connection.phpt" role="test" />
+ <file md5sum="55eb10f36825d8e1a2318e5947ad0a44" name="tests/amqpqueue_get_empty_body.phpt" role="test" />
+ <file md5sum="dc377fb179917882e8c650b55d74a90e" name="tests/amqpqueue_get_headers.phpt" role="test" />
+ <file md5sum="5dac2a6fec6de0e56de1cfae1dc1e00f" name="tests/amqpqueue_get_nonexistent.phpt" role="test" />
+ <file md5sum="313e782fa436468b403a91cea888d25f" name="tests/amqpqueue_headers_with_bool.phpt" role="test" />
+ <file md5sum="33fc812a759d2ee49088e50cf579bd63" name="tests/amqpqueue_headers_with_float.phpt" role="test" />
+ <file md5sum="c72762903b159ddf4d957b6cf4042e11" name="tests/amqpqueue_headers_with_null.phpt" role="test" />
+ <file md5sum="632a6c6a0eeb7fa8d7b826bc38614234" name="tests/amqpqueue_nack.phpt" role="test" />
+ <file md5sum="732281bac91e4234c02bbec49761acb9" name="tests/amqpqueue_nested_arrays.phpt" role="test" />
+ <file md5sum="5bf75db6b18f96021606f9428ccd1027" name="tests/amqpqueue_nested_headers.phpt" role="test" />
+ <file md5sum="9c99bcf458569aad3674b7e57c26d28f" name="tests/amqpqueue_purge_basic.phpt" role="test" />
+ <file md5sum="af33bd6cf5edc7c521ef3149ec744395" name="tests/amqpqueue_recover.phpt" role="test" />
+ <file md5sum="f54f4db6b201747c298c10e59af83342" name="tests/amqpqueue_setArgument.phpt" role="test" />
+ <file md5sum="8d80247651e8c347da949f1af9790548" name="tests/amqpqueue_setFlags.phpt" role="test" />
+ <file md5sum="89febc93c1ac5a5783a09a57fcfb36d1" name="tests/amqpqueue_unbind_basic_empty_routing_key.phpt" role="test" />
+ <file md5sum="18e0d925d449d09b59963e36e44137be" name="tests/amqpqueue_unbind_basic_headers_arguments.phpt" role="test" />
+ <file md5sum="79ed6e7f81da1a713e395d6a865cc13d" name="tests/amqpqueue_var_dump.phpt" role="test" />
+ <file md5sum="e0eff4d552c1d422eb3fa659e388d1e0" name="tests/amqptimestamp.phpt" role="test" />
+ <file md5sum="b3527d7047b8ce00fe7253ab509e2ba9" name="tests/bug_17831.phpt" role="test" />
+ <file md5sum="fc3e0833caffbf3ac1fbfd738d5e704b" name="tests/bug_19707.phpt" role="test" />
+ <file md5sum="13614b6a49334b3f9a893ab97d51f9c4" name="tests/bug_19840.phpt" role="test" />
+ <file md5sum="3b096590cd83812a446644bab8a058f6" name="tests/bug_351.phpt" role="test" />
+ <file md5sum="683207d3ded70596dcaf884d859c349c" name="tests/bug_385.phpt" role="test" />
+ <file md5sum="ccdd74fec3caef0a2cd30bd4aa0df4c2" name="tests/bug_61533.phpt" role="test" />
+ <file md5sum="126242b757c438ddc6df40e9b90ba881" name="tests/bug_62354.phpt" role="test" />
+ <file md5sum="3f747b780c7c0dfc69f11f832473a223" name="tests/bug_gh147.phpt" role="test" />
+ <file md5sum="0270be9f06a6e5376a00812428f13599" name="tests/bug_gh155_direct_reply_to.phpt" role="test" />
+ <file md5sum="6b182a7e62ad7e40adaae9a9985cd12b" name="tests/bug_gh50-1.phpt" role="test" />
+ <file md5sum="e32e342a4908eb398844a5db8704b173" name="tests/bug_gh50-2.phpt" role="test" />
+ <file md5sum="5a0143d9c56dee9b504aad664b74be8d" name="tests/bug_gh50-3.phpt" role="test" />
+ <file md5sum="4a8cb8c0ffab14146407d3d33f119eff" name="tests/bug_gh50-4.phpt" role="test" />
+ <file md5sum="178ac4ddaa01843473e69f041603efec" name="tests/bug_gh53-2.phpt" role="test" />
+ <file md5sum="6cf279a12525f882f2a0cecf3e82652f" name="tests/bug_gh53.phpt" role="test" />
+ <file md5sum="8a0a0e415aaae2ee16365cb1f74a67f3" name="tests/bug_gh72-1.phpt" role="test" />
+ <file md5sum="b495687b1aa185442ac8e98da6e96136" name="tests/bug_gh72-2.phpt" role="test" />
+ <file md5sum="7909930686b48fb2c7e34a6805edcd5d" name="tests/ini_validation_failure.phpt" role="test" />
+ <file md5sum="4b21a92ffefb786e725cebf0c2300c2e" name="tests/package-version.phpt" role="test" />
+ <file md5sum="164dbd88ba62e3269bac8856cb6dd899" name="tests/serialize-custom-amqpvalue-errors.phpt" role="test" />
+ <file md5sum="8af7b3b564223d1b5e571d3d8905e398" name="tests/serialize-custom-amqpvalue.phpt" role="test" />
+ <file md5sum="5a3b096ecddcc8355fa67f7305ddc44e" name="tests/testtest.phpt" role="test" />
<file md5sum="6fad4616560147bbc44b315f0bd53fe0" name="stubs/AMQP.php" role="doc" />
<file md5sum="f651a90990a9eaab2886a54c0ca79d39" name="stubs/AMQPBasicProperties.php" role="doc" />
- <file md5sum="a0187768f3d8d85622b555ebead8d226" name="stubs/AMQPChannel.php" role="doc" />
+ <file md5sum="0a7b8654409533826b0f6ef386e5b064" name="stubs/AMQPChannel.php" role="doc" />
<file md5sum="d79254277f60751c4ba6697333af5d37" name="stubs/AMQPChannelException.php" role="doc" />
- <file md5sum="322bbb2a719277d4633c96830bbb0500" name="stubs/AMQPConnection.php" role="doc" />
+ <file md5sum="45f1cd50439c4701378a70e5c4f91c5d" name="stubs/AMQPConnection.php" role="doc" />
<file md5sum="da1cd6ac1b51f2433904ce770e6f4ca3" name="stubs/AMQPConnectionException.php" role="doc" />
<file md5sum="883a5319cbb0716fcf94775a51cd71fa" name="stubs/AMQPDecimal.php" role="doc" />
- <file md5sum="e7561d0c10606accfb0b2b37cf8f52e2" name="stubs/AMQPEnvelope.php" role="doc" />
+ <file md5sum="8a576c4b69e28105e1c9373e34ec3a83" name="stubs/AMQPEnvelope.php" role="doc" />
<file md5sum="3e8664cbd98e06ae6b35c63ef1cab7c1" name="stubs/AMQPEnvelopeException.php" role="doc" />
<file md5sum="0b9b43b817a884d311f8f8013d8a5adc" name="stubs/AMQPException.php" role="doc" />
<file md5sum="6f36797b01b1b5b22fdc7dbb06ef8940" name="stubs/AMQPExchange.php" role="doc" />
<file md5sum="7d1035c7a2b82f9187b10f05fe882eed" name="stubs/AMQPExchangeException.php" role="doc" />
- <file md5sum="b34a1389079a0c41dd10c6e5d8d39a6a" name="stubs/AMQPQueue.php" role="doc" />
+ <file md5sum="44960c4edd92cfd1cf1bf7ce9574c43d" name="stubs/AMQPQueue.php" role="doc" />
<file md5sum="d7da0562e86197fc6bb0d12af0a25495" name="stubs/AMQPQueueException.php" role="doc" />
<file md5sum="11f9f2733ffddd29235c36ce335452ae" name="stubs/AMQPTimestamp.php" role="doc" />
<file md5sum="955ec77431aadc509085986c6adb7c2a" name="stubs/AMQPValue.php" role="doc" />
<file md5sum="ad5c4a89ec22580ef404656e3258d1f5" name="stubs/AMQPValueException.php" role="doc" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>7.4.0</min>
</php>
<pearinstaller>
<min>1.4.0</min>
</pearinstaller>
</required>
</dependencies>
<providesextension>amqp</providesextension>
<extsrcrelease>
<configureoption default="autodetect" name="with-librabbitmq-dir" prompt="Set the path to librabbitmq install prefix" />
</extsrcrelease>
<changelog>
+ <release>
+ <date>2023-09-07</date>
+ <time>06:52:04</time>
+ <version>
+ <release>2.1.0</release>
+ <api>2.1.0</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>
+- AMQPValue interface for custom value objects (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/473)
+ - Implement AMQPQueue::recover() to provide the basic.recover method (fixes #478) (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/484)
+ - Fix double free when an error occurs in AMQPQueue::consume() (Jan Prachar &lt;jan.prachar@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/482)
+ - Revamp error handling (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/485)
+ - Refactor AMQPQueue::consume error handling (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/483)
+ - Use RETURN_THROWS for parameter parsing errors (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/474)
+ - Fix auto-formatting (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/877b2f4)
+ - Remove appveyor badge (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/4971c80)
+ - Replace microtime() as a randomness source (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/4503e53)
+ - Fix version test for release builds (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/00a6715)
+ - Remove non-ASCII characters from package.xml to work around pecl.php.net issue (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/732f7e8)
+ - Bump actions/checkout from 3.5.3 to 3.6.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/475)
+ - Bump symplify/easy-coding-standard from 12.0.6 to 12.0.7 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/472)
+ - Bump actions/checkout from 3.5.3 to 3.6.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/471)
+ - Bump actions/checkout from 3.6.0 to 4.0.0 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/481)
+
+For a complete list of changes see:
+https://github.com/php-amqp/php-amqp/compare/v2.0.0...v2.1.0
+ </notes>
+ </release>
<release>
<date>2023-08-20</date>
<time>11:12:46</time>
<version>
<release>2.0.0</release>
<api>2.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
Notable changes:
- Fix various API oddities, see https://github.com/php-amqp/php-amqp/tree/v2.0.0/UPGRADING.md for details
- Remove support for PHP 5
- Various bug fixes
(!) Most use-cases should not require much changes from 1.x but check out
https://github.com/php-amqp/php-amqp/tree/v2.0.0/UPGRADING.md for a detailed upgrade guide
All changes (chronologically):
- CentOS development environment (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/467)
- Ubuntu development containers (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/466)
- Test against upcoming PHP 8.3 (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/465)
- Make test host configurable (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/464)
- Cosmetics on type functions (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/350202f)
- Configurable serialization/deserialization depth (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/463)
- Allow bitmask flags arguments to be nullable where previously AMQP_NOPARAM/zero was required (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/462)
- Fix generated commit URLs in changelogs (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/commit/4ee6159)
- Handle nested AMQP value serialization/deserialization (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/461)
- Document lack of reliability of AMQPConnection::isConnected (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/306)
- Prevent reuse of channel ID of broken channels (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/460)
- Gracefully handle zero as a heartbeat value (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/459)
- Build with the clang compiler on CI (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/457)
- Include stdint.h for PHP &gt;= 8.0 on Windows (Jan Ehrhardt) (https://github.com/php-amqp/php-amqp/issues/456)
- Fix segfault in setPort (Remi Collet &lt;remi@remirepo.net&gt;) (https://github.com/php-amqp/php-amqp/issues/455)
- Document BC changes (Lars Strojny &lt;lars@strojny.net&gt;)
- Document pseudo-bool method changes (Lars Strojny &lt;lars@strojny.net&gt;)
- Fix mangled header on MacOS (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/60)
- Validate argument parsing, add AMQPExchange::removeArgument() and AMQPQueue::removeArgument() (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/452)
- Skip SSL tests if certificates are missing (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/450)
- Check coding style and formatting of stub files (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/447)
- Parallelize test execution (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/444)
- Deterministic configuration for PHP CLI (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/443)
- Fix tag creation during release management (Lars Strojny &lt;lars@strojny.net&gt;)
- Move test-report.sh into infra (Lars Strojny &lt;lars@strojny.net&gt;)
- The big fat API renovation (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/437)
- Handle alpha/beta stability correctly (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/5546436)
- Expose better version information (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/438)
- Auto-format the codebase (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/436)
- More consistent return types for AMQPEnvelope (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/435)
- Update stubs (Lars Strojny &lt;lars@strojny.net&gt;)
- Fix parameter error handling in AMQPConnection and AMQPChannel (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/434)
- Increase credentials and identifier limits (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/433)
- Reliably clear consumer tag on AMQPQueue::cancel (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/432)
- Ignore failures on experimental builds (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/25)
- Update branch name (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/7)
- Bump shivammathur/setup-php from 2.25.3 to 2.25.4 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/431)
- PHP 8.2 refactorings (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/430)
- Fix php version check for static building (Misha Kulakovsky &lt;m@klkvsk.ru&gt;) (https://github.com/php-amqp/php-amqp/issues/425)
- Fix stub exception class (closes #427) (Lars Strojny &lt;lars@strojny.net&gt;)
- Document custom connection name in stubs (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/700000)
- Expose Delivery Mode through constants (Flavio Heleno &lt;flaviohbatista@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/420)
- Fix deprecation issue in PHP 8.1 for $consumerTag argument to AMQPQueue::consume() method (Liviu-Ionut Iosif) (https://github.com/php-amqp/php-amqp/issues/421)
- Fix: Deprecated: Creation of dynamic property (8.2) (Remi Collet &lt;remi@remirepo.net&gt;) (https://github.com/php-amqp/php-amqp/issues/418)
- Fix AMQPEnvelope::getDeliveryTag() return type (Flavio Heleno &lt;flaviohbatista@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/415)
- Fix ack/nack/reject param documentation (Flavio Heleno &lt;flaviohbatista@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/414)
- Mention time units in all timeout-related methods (Andrii Dembitskyi &lt;andrew.dembitskiy@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/410)
For a complete list of changes see:
https://github.com/php-amqp/php-amqp/compare/v1.11.0...v2.0.0
</notes>
</release>
<release>
<date>2023-08-15</date>
<time>22:10:56</time>
<version>
<release>2.0.0RC1</release>
<api>2.0.0RC1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Handle nested AMQP value serialization/deserialization (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/461)
- Document lack of reliability of AMQPConnection::isConnected (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/306)
- Prevent reuse of channel ID of broken channels (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/460)
- Gracefully handle zero as a heartbeat value (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/459)
- Build with the clang compiler on CI (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/457)
For a complete list of changes see:
https://github.com/php-amqp/php-amqp/compare/v2.0.0beta2...v2.0.0RC1
</notes>
</release>
<release>
<date>2023-08-03</date>
<time>06:22:40</time>
<version>
<release>2.0.0beta2</release>
<api>2.0.0beta2</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Include stdint.h for PHP &gt;= 8.0 on Windows (Jan Ehrhardt) (https://github.com/php-amqp/php-amqp/issues/456)
- Fix segfault in setPort (Remi Collet &lt;remi@remirepo.net&gt;) (https://github.com/php-amqp/php-amqp/issues/455)
(!) Check out https://github.com/php-amqp/php-amqp/tree/latest/UPGRADING.md for backward incompatible changes
For a complete list of changes see:
https://github.com/php-amqp/php-amqp/compare/v2.0.0beta1...v2.0.0beta2
</notes>
</release>
<release>
<date>2023-08-02</date>
<time>21:19:41</time>
<version>
<release>2.0.0beta1</release>
<api>2.0.0beta1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Document BC changes (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/0)
- Document pseudo-bool method changes (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/0)
- Fix mangled header on MacOS (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/60)
- Validate argument parsing, add AMQPExchange::removeArgument() and AMQPQueue::removeArgument() (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/452)
- Skip SSL tests if certificates are missing (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/450)
- Bump shivammathur/setup-php from 2.25.4 to 2.25.5 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/449)
- Check coding style and formatting of stub files (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/447)
- Parallelize test execution (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/444)
- Deterministic configuration for PHP CLI (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/443)
- Fix tag creation during release management (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/0)
- Move test-report.sh into infra (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/0)
(!) Check out https://github.com/php-amqp/php-amqp/tree/latest/UPGRADING.md for backward incompatible changes
For a complete list of changes see:
https://github.com/php-amqp/php-amqp/compare/v2.0.0alpha2...v2.0.0beta1
</notes>
</release>
<release>
<date>2023-07-29</date>
<time>08:51:15</time>
<version>
<release>2.0.0alpha1</release>
<api>2.0.0alpha1</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- The big fat API renovation (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/437)
- Handle alpha/beta stability correctly (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/5546436)
- Expose better version information (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/438)
- Auto-format the codebase (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/436)
- More consistent return types for AMQPEnvelope (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/435)
- Update stubs (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/0)
- Fix parameter error handling in AMQPConnection and AMQPChannel (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/434)
- Increase credentials and identifier limits (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/433)
- Reliably clear consumer tag on AMQPQueue::cancel (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/432)
- Ignore failures on experimental builds (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/25)
- Update branch name (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/7)
- Bump shivammathur/setup-php from 2.25.3 to 2.25.4 (dependabot[bot]) (https://github.com/php-amqp/php-amqp/issues/431)
- PHP 8.2 refactorings (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/430)
- Fix php version check for static building (Misha Kulakovsky &lt;m@klkvsk.ru&gt;) (https://github.com/php-amqp/php-amqp/issues/425)
- Fix stub exception class (closes #427) (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/0)
- Document custom connection name in stubs (Lars Strojny &lt;lars@strojny.net&gt;) (https://github.com/php-amqp/php-amqp/issues/700000)
- Expose Delivery Mode through constants (Flavio Heleno &lt;flaviohbatista@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/420)
- Fix deprecation issue in PHP 8.1 for $consumerTag argument to AMQPQueue::consume() method (Liviu-Ionut Iosif) (https://github.com/php-amqp/php-amqp/issues/421)
- Fix: Deprecated: Creation of dynamic property (8.2) (Remi Collet &lt;remi@remirepo.net&gt;) (https://github.com/php-amqp/php-amqp/issues/418)
- Fix AMQPEnvelope::getDeliveryTag() return type (Flavio Heleno &lt;flaviohbatista@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/415)
- Fix ack/nack/reject param documentation (Flavio Heleno &lt;flaviohbatista@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/414)
- Mention time units in all timeout-related methods (Andrii Dembitskyi &lt;andrew.dembitskiy@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/410)
For a complete list of changes see:
https://github.com/php-amqp/php-amqp/compare/v1.11.0...v2.0.0alpha1
</notes>
</release>
<release>
<date>2021-12-01</date>
<time>11:13:57</time>
<version>
<release>1.11.0</release>
<api>1.11.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- PHP 8.1 compatibility (Lars Strojny &lt;lars.strojny@internations.org&gt;) (https://github.com/php-amqp/php-amqp/issues/405)
- Install RabbitMQ from tarball instead of git to improve speed (Michele Locati &lt;michele@locati.it&gt;) (https://github.com/php-amqp/php-amqp/issues/392)
- Improve release tooling (Lars Strojny &lt;lars.strojny@internations.org&gt;)
For a complete list of changes see:
https://github.com/php-amqp/php-amqp/compare/v1.11.0RC1...v1.11.0
</notes>
</release>
<release>
<date>2021-11-02</date>
<time>11:56:51</time>
<version>
<release>1.11.0RC1</release>
<api>1.11.0RC1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- PHP 8 support for Windows (Jan Ehrhardt &lt;github@ehrhardt.nl&gt;) (https://github.com/php-amqp/php-amqp/issues/396) - Add installation instructions for Windows (Marcos Rezende &lt;rezehnde@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/394) - Fixes AMQPConnection Stub typo (Gregoire Pineau &lt;lyrixx@lyrixx.info&gt;) (https://github.com/php-amqp/php-amqp/issues/401) - Fix AMQPQueue stub (Gocha Ossinkine &lt;ossinkine@ya.ru&gt;) (https://github.com/php-amqp/php-amqp/issues/404) - SetReadTimeout accepts float param (Andrii Dembitskyi &lt;andrew.dembitskiy@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/388) - Move from Travis CI to Github Actions (Vadim Borodavko &lt;vadim.borodavko@gmail.com&gt;) (https://github.com/php-amqp/php-amqp/issues/391) - Release tooling: handle RC stability properly (Lars Strojny &lt;lars.strojny@internations.org&gt;) (https://github.com/php-amqp/php-amqp/issues/71) - More robust release tooling (Lars Strojny &lt;lars.strojny@internations.org&gt;) (https://github.com/php-amqp/php-amqp/issues/0)For a complete list of changes see:https://github.com/php-amqp/php-amqp/compare/v1.11.0beta...v1.11.0RC1
</notes>
</release>
<release>
<date>2020-04-05</date>
<time>17:40:42</time>
<version>
<release>1.10.2</release>
<api>1.10.2</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Windows build: avoid variable lengths arrays (Christoph M. Becker) (https://github.com/pdezwart/php-amqp/issues/368)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.10.1...v1.10.2
</notes>
</release>
<release>
<date>2020-04-05</date>
<time>16:04:23</time>
<version>
<release>1.10.1</release>
<api>1.10.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Fix Windows compatibility: avoid variable lengths arrays (Christoph M. Becker &lt;cmbecker69@gmx.de&gt;) (https://github.com/pdezwart/php-amqp/issues/368)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.10.0...v1.10.1
</notes>
</release>
<release>
<date>2020-04-03</date>
<time>19:17:00</time>
<version>
<release>1.10.0</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Adding global prefetch support (#366) (Terence Marks &lt;tezmarks@gmail.com&gt;) (https://github.com/pdezwart/php-amqp/issues/367) - Fix minimal librabbitmq in config.m4 and readme (Remi Collet &lt;remi@remirepo.net&gt;) (https://github.com/pdezwart/php-amqp/issues/347) - Support connection_name parameter for custom connection names in RabbitMQ (Alexandr Zolotukhin &lt;supersmile2009@gmail.com&gt;) (https://github.com/pdezwart/php-amqp/issues/363) - Fixed build on Travis CI (Alexandr Zolotukhin &lt;supersmile2009@gmail.com&gt;) (https://github.com/pdezwart/php-amqp/issues/365) - Make use of rpc_timeout in newer librabbitmq by introducing new constructor hash parameter (modulatix &lt;oleg.pereverzev@gmail.com&gt;) (https://github.com/pdezwart/php-amqp/issues/334) - Fix #355: Compile failure on php 7.4 (Christoph M. Becker &lt;cmbecker69@gmx.de&gt;) (https://github.com/pdezwart/php-amqp/issues/359) - Update amqp_type.c (Pawel Mikolajczuk &lt;pawel@mikolajczuk.in&gt;) (https://github.com/pdezwart/php-amqp/issues/360) - Build against PHP 7.4 (Carlos Barrero &lt;carlos.barrero@spotahome.com&gt;) (https://github.com/pdezwart/php-amqp/issues/361) - Pass params by value in AMQPConnection::__construct() (Sergei Karpov) (https://github.com/pdezwart/php-amqp/issues/346) - Fix explicit null-string for $routing_key in Queue::bind() and Exchange::publish() (Sergei Karpov) (https://github.com/pdezwart/php-amqp/issues/341) - No longer limited to PHP 5 (Lars Strojny &lt;lars.strojny@internations.org&gt;) (https://github.com/pdezwart/php-amqp/issues/0) - Fix minimal version to 5.6 (Remi Collet &lt;remi@famillecollet.com&gt;) (https://github.com/pdezwart/php-amqp/issues/338) - Back to dev (Lars Strojny &lt;lars.strojny@internations.org&gt;) (https://github.com/pdezwart/php-amqp/issues/1)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.9.4...v1.10.0
</notes>
</release>
<release>
<date>2017-10-19</date>
<time>16:00:00</time>
<version>
<release>1.9.4</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Improved build environment (Olivier Dolbeau) * Various bug fixes and improvements (Bogdan Padalko, yjqg6666) * Support for PHP 7.3 (Remi Collet)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.9.3...v1.9.4
</notes>
</release>
<release>
<date>2017-10-19</date>
<time>16:00:00</time>
<version>
<release>1.9.3</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Fix handling channel consumers (#284) (Bogdan Padalko) * Add support for consumer tags (#282) (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.9.1...v1.9.3
</notes>
</release>
<release>
<version>
<release>1.9.1</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Separate queue and exchange args to prevent segfault with opcache enabled (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.9.0...v1.9.1
</notes>
</release>
<release>
<version>
<release>1.9.0</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* AMQP types are now better supported through value objects (see #271, #269, #265) (Bogdan Padalko, Lars Strojny)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.8.0...v1.9.0
</notes>
</release>
<release>
<version>
<release>1.9.0beta2</release>
<api>1.3.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* AMQP types are now better supported through value objects (see #271, #269, #265) (Bogdan Padalko, Lars Strojny)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.8.0...v1.9.0beta2
</notes>
</release>
<release>
<version>
<release>1.9.0beta1</release>
<api>1.3.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* AMQP types are now better supported through value objects (see #271, #269, #265) (Bogdan Padalko, Lars Strojny) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.8.0...v1.9.0beta1
</notes>
</release>
<release>
<version>
<release>1.8.0</release>
<api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Add SSL connection support (Bogdan Padalko) * Support for server method handling: confirms (publisher acknowledgments) and basic.return (Bogdan Padalko) * Add support for pkg-config (Remi Collet) * Preserve AMQP server error code for exceptions (Bogdan Padalko) * Add AMQPChannel::close() (Bogdan Padalko) * Fix segfault when deleting an unknown exchange (Bogdan Padalko) * Fix segfault with PHPUnit and xdebug for PHP 7 (Bogdan Padalko) * Add publisher confirms (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.7.1...v1.8.0
</notes>
</release>
<release>
<version>
<release>1.8.0beta2</release>
<api>1.2.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Add SSL connection support (Bogdan Padalko) * Support for server method handling: confirms (publisher acknowledgments) and basic.return (Bogdan Padalko) * Add support for pkg-config (Remi Collet) * Preserve AMQP server error code for exceptions (Bogdan Padalko) * Add AMQPChannel::close() (Bogdan Padalko) * Fix segfault when deleting an unknown exchange (Bogdan Padalko) * Fix segfault with PHPUnit and xdebug for PHP 7 (Bogdan Padalko) * Add publisher confirms (Bogdan Padalko) * Fix 1.8.0 release (Lars Strojny) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.7.1...v1.8.0beta2
</notes>
</release>
<release>
<version>
<release>1.7.1</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Add support for pkg-config (Remi Collet) * Fixed wrongful truncation of amqp.password to the length of amqp.login (https://github.com/skobkars)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.7.0...v1.7.1
</notes>
</release>
<release>
<version>
<release>1.7.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Add PHP7 support (Bogdan Padalko, Steffen Hanikel) * Add AMQPEnvelope::hasHeader(), AMQPExchange::hasArgument() and AMQPQueue::hasArgument() to check whether specific header exists (Bogdan Padalko) * Fix AMQPConnection::setPort() writes to wrong property (Bogdan Padalko) * Add compiled librabbitmq version early check (Bogdan Padalko) * Fix segfault when channel zval type != IS_OBJECT (Bogdan Padalko) * Fix API breakage when rabbitmq-c &lt; 0.6.0 used (Bogdan Padalko) * Close connection on library errors (Bogdan Padalko) * Do not store connection resource ID string (Bogdan Padalko) * Explicitly cleanup references on connection on cleanup (Bogdan Padalko) * Show effective connection values when connection is active and passed values otherwise (Bogdad Padalko) * Completely move to zend object custom objects (AMQPEnvelope, AMQPExchange and AMQPQueue) (Bogdan Padalko) * Use zend object on custom objects for properties storing (AMQPConnection and AMQPChannel) (Bogdan Padalko) * Fix not properly deleted connection resource. (Bogdan Padalko, Steffen Hanikel) * Fix not properly allocated and freed amqp_table_t arguments table memory. (Bogdan Padalko, Steffen Hanikel) * Upgrade vagrant box to Ubuntu 15.10 Wily Werwof (Bogdan Padalko) * Fix various grammar and spelling mistakes (Artem Gordinsky) * Update stubs (Sascha-Oliver Prolic)For a complete list of changes see:https://github.com/pdezwart/php-amqp/compare/v1.6.0...v1.7.0
</notes>
</release>
<release>
<version>
<release>1.7.0alpha2</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Fix AMQPConnection::setPort() writes to wrong property (Bogdan Padalko) * Upgrade vagrant box to Ubuntu 15.10 Wily Werwof (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.7.0alpha1...v1.7.0alpha2
</notes>
</release>
<release>
<version>
<release>1.7.0alpha1</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Add PHP7 support (Bogdan Padalko, Steffen Hanikel) * Add AMQPEnvelope::hasHeader(), AMQPExchange::hasArgument() and AMQPQueue::hasArgument() to check whether specific header exists (Bogdan Padalko) * Completely move to zend object custom objects (AMQPEnvelope, AMQPExchange and AMQPQueue) (Bogdan Padalko) * Use zend object on custom objects for properties storing (AMQPConnection and AMQPChannel) (Bogdan Padalko) * Fix not properly deleted connection resource. (Bogdan Padalko, Steffen Hanikel) * Fix not properly allocated and freed amqp_table_t arguments table memory. (Bogdan Padalko, Steffen Hanikel) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.6.0...v1.7.0alpha1
</notes>
</release>
<release>
<version>
<release>1.6.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2015-11-03</date>
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD style</license>
<notes>
1.6.0 Release: * Various build fixes (Remi Collet) * librabbitmq 0.5 compatibility (Remi Collet) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.6.0beta4...v1.6.0
</notes>
</release>
<release>
<version>
<release>1.6.0beta4</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<date>2015-09-18</date>
<notes>
1.6.0beta4 Release: * Add ability to re-attach consuming callback (Bogdan Padalko) * Add AMQPQueue::getConsumerTag() method and fix consumer tag handling in AMQPQueue class methods (Bogdan Padalko) * Add channel_max, frame_max and hearbeat support (see AMQPConnection::__construct() method) (librabbitmq version &gt;= 0.6.0 required) (Bogdan Padalko) * Fix issue with message truncating to first null-byte during sending (Bogdan Padalko, special thanks to Alex Kazinskiy, Alvaro Videla and Michael Klishin) * Fix issue with message truncating to first null-byte during sending (Bogdan Padalko) * Fix invalid delivery mode returned by AMQPEnvelop::getDeliveryMode (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.6.0beta3...v1.6.0beta4
</notes>
</release>
<release>
<version>
<release>1.6.0beta3</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<date>2015-04-18</date>
<notes>
1.6.0beta3 Release: * Add basic.recover AMQP method support (see AMQPChannel::basicRecover() method) (Bogdan Padalko) * Fix building on OS X (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.6.0beta2...v1.6.0beta3
</notes>
</release>
<release>
<version>
<release>1.6.0beta2</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<date>2015-01-27</date>
<notes>
1.6.0beta2 Release: * Pulled 1.6.0beta1, as it had the stable tag * Add support for nested arguments values (Bogdan Padalko) * Add auto_delete and internal flags support for AMQPExchange::declare (librabbitmq version &gt; 0.5.2 required) (Bogdan Padalko) * Fix persistence support (Bogdan Padalko) * Add AMQPExchange::unbind method and fix AMQPExchange::bind method. WARNING: this can potentially break BC (Bogdan Padalko) * Add support to consume messages from multiple queues (Bogdan Padalko) * Add AMQP_DURABLE flag support to AMQPExchange::setFlags (librabbitmq version &gt; 0.5.2 required) (Bogdan Padalko) * Fix inconsistent INI values comparison which leads to deprecation warnings (Bogdan Padalko) * Various segfault and memory leak fixes (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.4.0...v1.6.0beta2
</notes>
</release>
<release>
<version>
<release>1.4.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2014-04-14</date>
<notes>
1.4.0 Release: * Fix #72: Publishing to an exchange with an empty name is valid and should not throw an exception (lstrojny) * Fix #77: AMQPQueue::delete() now no longer returns a boolean, but an integer of how many messages were deleted. WARNING: this can potentially break BC (Bogdan Padalko) * Fix #75: adhering to the AMQP spec by closing channel and sometimes even the connection in case of certain errors (Bogdan Padalko) * Fix #81: Add optional arguments parameter to bind()/unbind() (Michael Squires) * Fix #82: additional getters (getChannel(), getConnection()) (Bogdan Padalko) * Fix #92: fix various memory leaks in the AMQPConnection class (Lars Strojny) * Using amqp_error_string2() instead of deprecated amqp_error_string() (Lars Strojny) * Fix memory leaks in setHost, setLogin, setPassword, setVhost (Lars Strojny, Bogdan Padalko) * Fixed a memleak in php_amqp_connect (Julien Pauli) * Use rabbitmq-c defaults for max channels and default frame size (Bogdan Padalko) * Fix socket timeout error when connecting over high-latency network (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.4.0beta2...v1.4.0
</notes>
</release>
<release>
<version>
<release>1.4.0beta2</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<date>2014-03-08</date>
<notes>
1.4.0beta2 Release: * - For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.4.0beta1...v1.4.0beta2
</notes>
</release>
<release>
<version>
<release>1.4.0beta1</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<date>2014-01-15</date>
<notes>
1.4.0beta1 Release: * - For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.3.0...v1.4.0beta1
</notes>
</release>
<release>
<version>
<release>1.3.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>stable</api>
</stability>
<date>2013-11-25</date>
<notes>
1.3.0 Release: * Allow retrieving auto-delete exchanges (Guilherme Blanco) * Add connection timeout support. This requires bumping the version requirement for librabbitmq to &gt;= 0.4.1 (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.2.0...v1.3.0
</notes>
</release>
<release>
<version>
<release>1.2.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2013-05-28</date>
<notes>
1.2.0 Release: * New methods AMQPChannel::getPrefetchCount() and AMQPChannel::getPrefetchSize() * Deprecate AMQPQueue::declare() in favor of AMQPQueue::declareQueue() * Deprecate AMQPExchange::declare() in favor of AMQPExchange::declareExchange() * Smaller fixes to our stubs For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.0.10...v1.2.0
</notes>
</release>
<release>
<version>
<release>1.0.10</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2013-05-28</date>
<notes>
1.0.10 Release: * report correct version in module info (Lars Strojny) * fix class interface definitions (Vladimir Kartaviy) * add ability to bind a queue with an empty routing key (Vladimir Kartaviy) * fix constant AMQP_IFUNUSED (Florin Patan, Bernhard Weisshuhn) * added stubs for ide use (Vladimir Kartaviy, Bernhard Weisshuhn) * Fixed memory leak in queue-&gt;declareQueue (Ilya a.k.a. coodix) * support for php 5.5 (Lars Strojny) * add support for read and write timeouts (Bogdan Padalko) * fix memory leak in queue-&gt;consume (Dmitry Vinogradov) * add support for custom exchange types (empi89) * support for nested custom headers (Bernhard Weisshuhn) * fix memory (Bernhard Weisshuhn) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.0.9...v1.0.10
</notes>
</release>
<release>
<version>
<release>1.0.9</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-11-13</date>
<notes>
1.0.9 Release: * Fix pecl relase
</notes>
</release>
<release>
<version>
<release>1.0.8</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-11-12</date>
<notes>
1.0.8 Release: * Skip var_dump test on PHP 5.2 * Initialize consumer tag string length to zero * Support connection time outs * Adding consumer_tag parameter to AMQPQueue::cancel * Clean up error code handling
</notes>
</release>
<release>
<version>
<release>1.0.7</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-09-10</date>
<notes>
1.0.7 Release: * Adding missing macros
</notes>
</release>
<release>
<version>
<release>1.0.6</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-09-10</date>
<notes>
1.0.6 Release: * 62354: Segmentation fault when printing or dumping an object that contains an AMQP object * Adding in missing tests * Fixing release number in PHP information * Adding .gitignore info for Git users * Cleaning up debug handling
</notes>
</release>
<release>
<version>
<release>1.0.5</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-08-26</date>
<notes>
1.0.5 Release: * 62696: Incorrect exchange type * Handles server connections being closed during consume and publish correctly * 62628: Exception thrown in consume will lock PHP * 61533: Segmentation fault when instantiating channel, queue or exchange with wrong object, then using it
</notes>
</release>
<release>
<version>
<release>1.0.4</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-07-18</date>
<notes>
1.0.4 Release: * 62549: Fixing broken persistent connection * 62412: Fixing segfault due to destruction order * 62411: Fixing declaration overload bug * 62410: Fixing declaration overload for 5.4 * 61337: Adding License file * 61749: Fixing handling for binary content in envelope * 62087: Adding appropriate version information * 62354: Enabling debugging dumping of objects * 61351: Updating min PHP version requirements to 5.2.0
</notes>
</release>
<release>
<version>
<release>1.0.3</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-05-19</date>
<notes>
1.0.3 Release: * Fixing compilation issue with PHP 5.4 * Memory leak when using AMQPQueue::get from a queue with no messages
</notes>
</release>
<release>
<version>
<release>1.0.1</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-03-02</date>
<notes>
1.0.1 Release:Fixed bug: * 61247: Allow queue creation with empty queue name, and return auto generated name * 61127: Segmentation fault when cleaning up an AMQPChannel without calling AMQPConnection::connect first
</notes>
</release>
<release>
<version>
<release>1.0.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2012-02-15</date>
<notes>
1.0.0 Release:Changed/finalized API signature: * Exposing AMQPChannel * Exposing AMQPEnvelope * Exposing more queue and exchange arguments and flags * Exposing basic.qosAdded persistent connectionsCleaned up codebaseFixed memory leaks and segmentation faults
</notes>
</release>
<release>
<version>
<release>0.3.1</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2011-09-08</date>
<notes>
0.3.1 Release:Fixed bug: * 24323: Cannot get the name for auto-named reply-to queues
</notes>
</release>
<release>
<version>
<release>0.3.0</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2011-06-09</date>
<notes>
0.3.0 Release:Fixed memory leaks in many functions (courtesy Jonathan Tansavatdi and Andy Wick)Fixed consume method to return proper valuesCleaned up variable usageFixed bugs: * 22638: Unexpected exit code 1 with AMQPQueue::consume() * 22698: AMQPQueue::consume
</notes>
</release>
<release>
<version>
<release>0.2.2</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2011-01-02</date>
<notes>
0.2.2 Release:Made extension compatible with PHP lt 5.3 (courtesy John Skopis)Fixed wrong typing of message properties (courtesy John Skopis)
</notes>
</release>
<release>
<version>
<release>0.2.1</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2010-12-10</date>
<notes>
0.2.1 Release:Fixed refcount decrementing bug causing segfaults.
</notes>
</release>
<release>
<version>
<release>0.2.0</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2010-12-10</date>
<notes>
0.2.0 Release:Works with AMQP 0-8 and 0-9-1 (used by RabbitMQ 2.*)Modified AMQPConnection object: * Requires call to &apos;connect&apos; method to connect (no longer connects on instantiation) * Added support for disconnect and reconnect * Added helper setters for port, host, vhost, login and passwordImproved consume method to block for MIN messages, and try to get MAX messages if availableFixed zval descoping bugsFixed bugs: * 17809: Couldn&apos;t compile pecl extension under PHP 5.3 * 17831: Segmentation fault when the exchange doesn&apos;t exists * 19707: AMQPQueue::get() doesn&apos;t return the message * 19840: Connection Exception
</notes>
</release>
<release>
<version>
<release>0.1.1</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2010-08-19</date>
<notes>
Updating extension to work with new rabbitmq-c library
</notes>
</release>
<release>
<version>
<release>0.1.0</release>
<api>0.0.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2010-06-19</date>
<notes>
- Initial release
</notes>
</release>
</changelog>
</package>

File Metadata

Mime Type
text/x-diff
Expires
Fri, May 15, 12:20 AM (23 h, 19 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63772
Default Alt Text
(758 KB)

Event Timeline