Page MenuHomePhabricator (Chris)

No OneTemporary

Size
347 KB
Referenced Files
None
Subscribers
None
This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/amqp-1.9.1/CREDITS b/amqp-1.9.3/CREDITS
similarity index 100%
rename from amqp-1.9.1/CREDITS
rename to amqp-1.9.3/CREDITS
diff --git a/amqp-1.9.1/LICENSE b/amqp-1.9.3/LICENSE
similarity index 100%
rename from amqp-1.9.1/LICENSE
rename to amqp-1.9.3/LICENSE
diff --git a/amqp-1.9.1/amqp.c b/amqp-1.9.3/amqp.c
similarity index 97%
rename from amqp-1.9.1/amqp.c
rename to amqp-1.9.3/amqp.c
index 0f13763..c3dbc4e 100644
--- a/amqp-1.9.1/amqp.c
+++ b/amqp-1.9.3/amqp.c
@@ -1,336 +1,341 @@
/*
+----------------------------------------------------------------------+
| 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 "ext/standard/info.h"
#include "zend_ini.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
# include "win32/signal.h"
#else
# include <stdint.h>
# include <signal.h>
#endif
#include <amqp.h>
#include <amqp_framing.h>
#include "php_amqp.h"
#include "amqp_connection.h"
#include "amqp_basic_properties.h"
#include "amqp_connection_resource.h"
#include "amqp_channel.h"
#include "amqp_envelope.h"
#include "amqp_exchange.h"
#include "amqp_queue.h"
#include "amqp_timestamp.h"
#include "amqp_decimal.h"
#ifdef PHP_WIN32
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
/* True global resources - no need for thread safety here */
zend_class_entry *amqp_exception_class_entry,
*amqp_connection_exception_class_entry,
*amqp_channel_exception_class_entry,
*amqp_queue_exception_class_entry,
*amqp_exchange_exception_class_entry,
+ *amqp_envelope_exception_class_entry,
*amqp_value_exception_class_entry;
/* {{{ amqp_functions[]
*
*Every user visible function must have an entry in amqp_functions[].
*/
zend_function_entry amqp_functions[] = {
{NULL, NULL, NULL}
};
/* }}} */
PHP_INI_BEGIN()
PHP_INI_ENTRY("amqp.host", DEFAULT_HOST, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.vhost", DEFAULT_VHOST, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.port", DEFAULT_PORT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.timeout", DEFAULT_TIMEOUT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.read_timeout", DEFAULT_READ_TIMEOUT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.write_timeout", DEFAULT_WRITE_TIMEOUT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.connect_timeout", DEFAULT_CONNECT_TIMEOUT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.login", DEFAULT_LOGIN, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.password", DEFAULT_PASSWORD, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.auto_ack", DEFAULT_AUTOACK, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.prefetch_count", DEFAULT_PREFETCH_COUNT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.channel_max", DEFAULT_CHANNEL_MAX, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.frame_max", DEFAULT_FRAME_MAX, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.heartbeat", DEFAULT_HEARTBEAT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.cacert", DEFAULT_CACERT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.cert", DEFAULT_CERT, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.key", DEFAULT_KEY, PHP_INI_ALL, NULL)
PHP_INI_ENTRY("amqp.verify", DEFAULT_VERIFY, PHP_INI_ALL, NULL)
PHP_INI_END()
ZEND_DECLARE_MODULE_GLOBALS(amqp);
static PHP_GINIT_FUNCTION(amqp) /* {{{ */
{
amqp_globals->error_message = NULL;
amqp_globals->error_code = 0;
} /* }}} */
static PHP_MINIT_FUNCTION(amqp) /* {{{ */
{
zend_class_entry ce;
/* Set up the connection resource */
le_amqp_connection_resource = zend_register_list_destructors_ex(amqp_connection_resource_dtor, NULL, PHP_AMQP_CONNECTION_RES_NAME, module_number);
le_amqp_connection_resource_persistent = zend_register_list_destructors_ex(NULL, amqp_connection_resource_dtor_persistent, PHP_AMQP_CONNECTION_RES_NAME, module_number);
PHP_MINIT(amqp_connection)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_channel)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_queue)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_exchange)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_basic_properties)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_envelope)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_timestamp)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(amqp_decimal)(INIT_FUNC_ARGS_PASSTHRU);
/* Class Exceptions */
INIT_CLASS_ENTRY(ce, "AMQPException", NULL);
amqp_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C));
INIT_CLASS_ENTRY(ce, "AMQPConnectionException", NULL);
amqp_connection_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
INIT_CLASS_ENTRY(ce, "AMQPChannelException", NULL);
amqp_channel_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
INIT_CLASS_ENTRY(ce, "AMQPQueueException", NULL);
amqp_queue_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
+ INIT_CLASS_ENTRY(ce, "AMQPEnvelopeException", NULL);
+ amqp_envelope_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
+ zend_declare_property_null(amqp_envelope_exception_class_entry, ZEND_STRL("envelope"), ZEND_ACC_PUBLIC TSRMLS_CC);
+
INIT_CLASS_ENTRY(ce, "AMQPExchangeException", NULL);
amqp_exchange_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
INIT_CLASS_ENTRY(ce, "AMQPValueException", NULL);
amqp_value_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
REGISTER_INI_ENTRIES();
REGISTER_LONG_CONSTANT("AMQP_NOPARAM", AMQP_NOPARAM, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_JUST_CONSUME", AMQP_JUST_CONSUME, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_DURABLE", AMQP_DURABLE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_PASSIVE", AMQP_PASSIVE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_EXCLUSIVE", AMQP_EXCLUSIVE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_AUTODELETE", AMQP_AUTODELETE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_INTERNAL", AMQP_INTERNAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_NOLOCAL", AMQP_NOLOCAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_AUTOACK", AMQP_AUTOACK, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_IFEMPTY", AMQP_IFEMPTY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_IFUNUSED", AMQP_IFUNUSED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_MANDATORY", AMQP_MANDATORY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_IMMEDIATE", AMQP_IMMEDIATE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_MULTIPLE", AMQP_MULTIPLE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_NOWAIT", AMQP_NOWAIT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_REQUEUE", AMQP_REQUEUE, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("AMQP_EX_TYPE_DIRECT", AMQP_EX_TYPE_DIRECT, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("AMQP_EX_TYPE_FANOUT", AMQP_EX_TYPE_FANOUT, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("AMQP_EX_TYPE_TOPIC", AMQP_EX_TYPE_TOPIC, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("AMQP_EX_TYPE_HEADERS",AMQP_EX_TYPE_HEADERS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMQP_OS_SOCKET_TIMEOUT_ERRNO", AMQP_OS_SOCKET_TIMEOUT_ERRNO, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PHP_AMQP_MAX_CHANNELS", PHP_AMQP_MAX_CHANNELS, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
} /* }}} */
static PHP_MSHUTDOWN_FUNCTION(amqp) /* {{{ */
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
} /* }}} */
static PHP_RSHUTDOWN_FUNCTION(amqp) /* {{{ */
{
if (NULL != PHP_AMQP_G(error_message)) {
efree(PHP_AMQP_G(error_message));
PHP_AMQP_G(error_message) = NULL;
}
PHP_AMQP_G(error_code) = 0;
return SUCCESS;
} /* }}} */
static PHP_MINFO_FUNCTION(amqp) /* {{{ */
{
php_info_print_table_start();
php_info_print_table_header(2, "Version", PHP_AMQP_VERSION);
php_info_print_table_header(2, "Revision", PHP_AMQP_REVISION);
php_info_print_table_header(2, "Compiled", __DATE__ " @ " __TIME__);
php_info_print_table_header(2, "AMQP protocol version", "0-9-1");
php_info_print_table_header(2, "librabbitmq version", amqp_version());
php_info_print_table_header(2, "Default max channels per connection", DEFAULT_CHANNEL_MAX);
php_info_print_table_header(2, "Default max frame size", DEFAULT_FRAME_MAX);
php_info_print_table_header(2, "Default heartbeats interval", DEFAULT_HEARTBEAT);
DISPLAY_INI_ENTRIES();
} /* }}} */
/* {{{ amqp_module_entry
*/
zend_module_entry amqp_module_entry = {
STANDARD_MODULE_HEADER,
"amqp",
amqp_functions,
PHP_MINIT(amqp),
PHP_MSHUTDOWN(amqp),
NULL,
PHP_RSHUTDOWN(amqp),
PHP_MINFO(amqp),
PHP_AMQP_VERSION,
PHP_MODULE_GLOBALS(amqp),
PHP_GINIT(amqp),
NULL,
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
#ifdef COMPILE_DL_AMQP
ZEND_GET_MODULE(amqp)
#endif
int php_amqp_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource TSRMLS_DC)
{
return php_amqp_error_advanced(reply, message, connection_resource, channel_resource, 1 TSRMLS_CC);
}
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 TSRMLS_DC)
{
assert(connection_resource != NULL);
PHP_AMQP_G(error_code) = 0;
if (*message != NULL) {
efree(*message);
}
int res = php_amqp_connection_resource_error(reply, message, connection_resource, (amqp_channel_t)(channel_resource ? channel_resource->channel_id : 0) TSRMLS_CC);
switch (res) {
case PHP_AMQP_RESOURCE_RESPONSE_OK:
break;
case PHP_AMQP_RESOURCE_RESPONSE_ERROR:
if (!fail_on_errors) {
break;
}
/* Library or other non-protocol or even protocol related errors may be here. */
/* In most cases it designate some underlying hard errors. Fail fast. */
case PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED:
/* Mark connection resource as closed to prevent sending any further requests */
connection_resource->is_connected = '\0';
/* Close connection with all its channels */
php_amqp_disconnect_force(connection_resource TSRMLS_CC);
break;
case PHP_AMQP_RESOURCE_RESPONSE_ERROR_CHANNEL_CLOSED:
/* Mark channel as closed to prevent sending channel.close request */
assert(channel_resource != NULL);
if (channel_resource) {
channel_resource->is_connected = '\0';
/* Close channel */
php_amqp_close_channel(channel_resource, 1 TSRMLS_CC);
}
/* No more error handling necessary, returning. */
break;
default:
spprintf(message, 0, "Unknown server error, method id 0x%08X (not handled by extension)", reply.reply.id);
break;
}
return res;
}
void php_amqp_zend_throw_exception_short(amqp_rpc_reply_t reply, zend_class_entry *exception_ce TSRMLS_DC) {
php_amqp_zend_throw_exception(reply, exception_ce, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
}
void php_amqp_zend_throw_exception(amqp_rpc_reply_t reply, zend_class_entry *exception_ce, const char *message, PHP5to7_param_long_type_t code TSRMLS_DC)
{
switch (reply.reply_type) {
case AMQP_RESPONSE_NORMAL:
break;
case AMQP_RESPONSE_NONE:
exception_ce = amqp_exception_class_entry;
break;
case AMQP_RESPONSE_LIBRARY_EXCEPTION:
exception_ce = amqp_exception_class_entry;
break;
case AMQP_RESPONSE_SERVER_EXCEPTION:
switch (reply.reply.id) {
case AMQP_CONNECTION_CLOSE_METHOD:
/* Fatal errors - pass them to connection level */
exception_ce = amqp_connection_exception_class_entry;
break;
case AMQP_CHANNEL_CLOSE_METHOD:
/* Most channel-level errors occurs due to previously known action and thus their kind can be predicted. */
/* exception_ce = amqp_channel_exception_class_entry; */
break;
}
break;
/* Default for the above switch should be handled by the below default. */
default:
exception_ce = amqp_exception_class_entry;
break;
}
zend_throw_exception(exception_ce, message, code TSRMLS_CC);
}
void php_amqp_maybe_release_buffers_on_channel(amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource)
{
assert(channel_resource != NULL);
assert(channel_resource->channel_id > 0);
if (connection_resource) {
amqp_maybe_release_buffers_on_channel(connection_resource->connection_state, channel_resource->channel_id);
}
}
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/amqp_basic_properties.c b/amqp-1.9.3/amqp_basic_properties.c
similarity index 100%
rename from amqp-1.9.1/amqp_basic_properties.c
rename to amqp-1.9.3/amqp_basic_properties.c
diff --git a/amqp-1.9.1/amqp_basic_properties.h b/amqp-1.9.3/amqp_basic_properties.h
similarity index 100%
rename from amqp-1.9.1/amqp_basic_properties.h
rename to amqp-1.9.3/amqp_basic_properties.h
diff --git a/amqp-1.9.1/amqp_channel.c b/amqp-1.9.3/amqp_channel.c
similarity index 97%
rename from amqp-1.9.1/amqp_channel.c
rename to amqp-1.9.3/amqp_channel.c
index 0d9069b..f3dba5d 100644
--- a/amqp-1.9.1/amqp_channel.c
+++ b/amqp-1.9.3/amqp_channel.c
@@ -1,1196 +1,1230 @@
/*
+----------------------------------------------------------------------+
| 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 "ext/standard/info.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
# include "win32/signal.h"
#else
# include <stdint.h>
# include <signal.h>
#endif
#include <amqp.h>
#include <amqp_framing.h>
#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, zend_bool check_errors TSRMLS_DC)
{
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_channel_close(connection_resource->connection_state, channel_resource->channel_id, AMQP_REPLY_SUCCESS);
amqp_rpc_reply_t res = amqp_get_rpc_reply(connection_resource->connection_state);
if (check_errors && PHP_AMQP_MAYBE_ERROR(res, channel_resource)) {
php_amqp_zend_throw_exception_short(res, amqp_channel_exception_class_entry TSRMLS_CC);
return;
}
php_amqp_maybe_release_buffers_on_channel(connection_resource, channel_resource);
}
}
#if PHP_MAJOR_VERSION >= 7
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_REFCOUNT(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_REFCOUNT(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;
}
static HashTable *amqp_channel_gc(zval *object, zval **table, int *n) /* {{{ */
{
amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(object);
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 TSRMLS_CC);
} /* }}} */
#else
static void php_amqp_destroy_fci(zend_fcall_info *fci) {
if (fci->size > 0) {
zval_ptr_dtor(&fci->function_name);
if (fci->object_ptr != NULL) {
zval_ptr_dtor(&fci->object_ptr);
}
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_ptr != NULL) {
zval_add_ref(&source->object_ptr);
}
}
}
static int php_amqp_get_fci_gc_data_count(zend_fcall_info *fci) {
int cnt = 0;
if (fci->size > 0) {
cnt ++;
if (fci->object_ptr != NULL) {
cnt++;
}
}
return cnt;
}
static int php_amqp_get_fci_gc_data(zend_fcall_info *fci, zval **gc_data, int offset) {
if (ZEND_FCI_INITIALIZED(*fci)) {
gc_data[offset++] = fci->function_name;
if (fci->object_ptr != NULL) {
gc_data[offset++] = fci->object_ptr;
}
}
return offset;
}
static HashTable *amqp_channel_gc(zval *object, zval ***table, int *n TSRMLS_DC) /* {{{ */
{
amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(object);
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 *) * channel->gc_data_count);
}
php_amqp_get_fci_gc_data(&channel->callbacks.basic_return.fci, channel->gc_data, 0);
php_amqp_get_fci_gc_data(&channel->callbacks.basic_ack.fci, channel->gc_data, basic_return_cnt);
php_amqp_get_fci_gc_data(&channel->callbacks.basic_nack.fci, channel->gc_data, basic_return_cnt + basic_ack_cnt);
*table = channel->gc_data;
*n = cnt;
return zend_std_get_properties(object TSRMLS_CC);
} /* }}} */
#endif
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(PHP5to7_obj_free_zend_object *object TSRMLS_DC)
{
amqp_channel_object *channel = PHP_AMQP_FETCH_CHANNEL(object);
if (channel->channel_resource != NULL) {
php_amqp_close_channel(channel->channel_resource, 0 TSRMLS_CC);
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 TSRMLS_CC);
#if PHP_MAJOR_VERSION < 7
+ if (channel->this_ptr) {
+ channel->this_ptr = NULL;
+ }
+
efree(object);
#endif
}
PHP5to7_zend_object_value amqp_channel_ctor(zend_class_entry *ce TSRMLS_DC)
{
amqp_channel_object *channel = PHP5to7_ECALLOC_CHANNEL_OBJECT(ce);
zend_object_std_init(&channel->zo, ce TSRMLS_CC);
AMQP_OBJECT_PROPERTIES_INIT(channel->zo, ce);
#if PHP_MAJOR_VERSION >=7
channel->zo.handlers = &amqp_channel_object_handlers;
return &channel->zo;
#else
PHP5to7_zend_object_value new_value;
new_value.handle = zend_objects_store_put(
channel,
NULL,
(zend_objects_free_object_storage_t) amqp_channel_free,
NULL TSRMLS_CC
);
new_value.handlers = zend_get_std_object_handlers();
return new_value;
#endif
}
/* {{{ proto AMQPChannel::__construct(AMQPConnection obj)
*/
static PHP_METHOD(amqp_channel_class, __construct)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
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() TSRMLS_CC, "o", &connection_object) == FAILURE) {
zend_throw_exception(amqp_channel_exception_class_entry, "Parameter must be an instance of AMQPConnection.", 0 TSRMLS_CC);
RETURN_NULL();
}
+ PHP5to7_zval_t consumers PHP5to7_MAYBE_SET_TO_NULL;
+
+ PHP5to7_MAYBE_INIT(consumers);
+ PHP5to7_ARRAY_INIT(consumers);
+
+ zend_update_property(this_ce, getThis(), ZEND_STRL("consumers"), PHP5to7_MAYBE_PTR(consumers) TSRMLS_CC);
+
+ PHP5to7_MAYBE_DESTROY(consumers);
+
channel = PHP_AMQP_GET_CHANNEL(getThis());
+#if PHP_MAJOR_VERSION < 7
+ channel->this_ptr = getThis();
+#endif
/* Set the prefetch count */
zend_update_property_long(this_ce, getThis(), ZEND_STRL("prefetch_count"), INI_INT("amqp.prefetch_count") TSRMLS_CC);
/* 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 TSRMLS_CC);
return;
}
if (!connection->connection_resource->is_connected) {
zend_throw_exception(amqp_channel_exception_class_entry, "Could not create channel. Connection resource is not connected.", 0 TSRMLS_CC);
return;
}
zend_update_property(this_ce, getThis(), ZEND_STRL("connection"), connection_object TSRMLS_CC);
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 TSRMLS_CC);
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 TSRMLS_CC);
}
/* 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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
/* Prevent double free, it may happens in case case 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 insibe 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("prefetch_count"), /* 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 TSRMLS_CC);
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 TSRMLS_CC);
}
}
/* }}} */
/* {{{ 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)
{
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t prefetch_count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &prefetch_count) == FAILURE) {
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 TSRMLS_CC);
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, getThis(), ZEND_STRL("prefetch_count"), prefetch_count TSRMLS_CC);
zend_update_property_long(this_ce, getThis(), ZEND_STRL("prefetch_size"), 0 TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto long amqp::setPrefetchCount()
get the number of prefetches */
static PHP_METHOD(amqp_channel_class, getPrefetchCount)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("prefetch_count")
}
/* }}} */
/* {{{ proto bool amqp::setPrefetchSize(long size)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, setPrefetchSize)
{
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t prefetch_size;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &prefetch_size) == FAILURE) {
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,
(uint16_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 TSRMLS_CC);
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, getThis(), ZEND_STRL("prefetch_count"), 0 TSRMLS_CC);
zend_update_property_long(this_ce, getThis(), ZEND_STRL("prefetch_size"), prefetch_size TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto long amqp::getPrefetchSize()
get the number of prefetches */
static PHP_METHOD(amqp_channel_class, getPrefetchSize)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("prefetch_size")
}
/* }}} */
/* {{{ proto amqp::qos(long size, long count)
set the number of prefetches */
static PHP_METHOD(amqp_channel_class, qos)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t prefetch_size;
PHP5to7_param_long_type_t prefetch_count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &prefetch_size, &prefetch_count) == FAILURE) {
return;
}
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 - the implication is to disable the count */
zend_update_property_long(this_ce, getThis(), ZEND_STRL("prefetch_size"), prefetch_size TSRMLS_CC);
zend_update_property_long(this_ce, getThis(), ZEND_STRL("prefetch_count"), prefetch_count TSRMLS_CC);
/* 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,
(uint16_t)PHP_AMQP_READ_THIS_PROP_LONG("prefetch_size"),
(uint16_t)PHP_AMQP_READ_THIS_PROP_LONG("prefetch_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 - 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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ 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;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ 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;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ 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;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ proto AMQPChannel::getConnection()
Get the AMQPConnection object in use */
static PHP_METHOD(amqp_channel_class, getConnection)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
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;
zend_bool requeue = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &requeue) == FAILURE) {
return;
}
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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ proto bool amqp::confirmSelect()
Redeliver unacknowledged messages */
PHP_METHOD(amqp_channel_class, confirmSelect)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ 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() TSRMLS_CC, "f!", &fci, &fcc) == FAILURE) {
return;
}
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() TSRMLS_CC, "|d", &timeout) == FAILURE) {
return;
}
if (timeout < 0) {
zend_throw_exception(amqp_channel_exception_class_entry, "Timeout must be greater than or equal to zero.", 0 TSRMLS_CC);
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 TSRMLS_CC);
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
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_resource->connection_resource, channel_resource->channel_id, channel, &method TSRMLS_CC);
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
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() TSRMLS_CC, "f!|f!", &ack_fci, &ack_fcc, &nack_fci, &nack_fcc) == FAILURE) {
return;
}
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() TSRMLS_CC, "|d", &timeout) == FAILURE) {
return;
}
if (timeout < 0) {
zend_throw_exception(amqp_channel_exception_class_entry, "Timeout must be greater than or equal to zero.", 0 TSRMLS_CC);
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 TSRMLS_CC);
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
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_resource->connection_resource, channel_resource->channel_id, channel, &method TSRMLS_CC);
break;
case AMQP_BASIC_NACK_METHOD:
status = php_amqp_handle_basic_nack(&PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource->channel_id, channel, &method TSRMLS_CC);
break;
case AMQP_BASIC_RETURN_METHOD:
status = php_amqp_handle_basic_return(&PHP_AMQP_G(error_message), channel_resource->connection_resource, channel_resource->channel_id, channel, &method TSRMLS_CC);
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
}
}
/* }}} */
+/* {{{ proto amqp::getConsumers() */
+static PHP_METHOD(amqp_channel_class, getConsumers)
+{
+ PHP5to7_READ_PROP_RV_PARAM_DECL;
+ PHP_AMQP_NOPARAMS();
+ PHP_AMQP_RETURN_THIS_PROP("consumers");
+}
+/* }}} */
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class__construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_OBJ_INFO(0, amqp_connection, AMQPConnection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_isConnected, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_close, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_getChannelId, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_setPrefetchSize, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, size)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_getPrefetchSize, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_setPrefetchCount, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, count)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_getPrefetchCount, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_qos, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2)
ZEND_ARG_INFO(0, size)
ZEND_ARG_INFO(0, count)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_startTransaction, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_commitTransaction, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_rollbackTransaction, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_getConnection, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_basicRecover, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_INFO(0, requeue)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_confirmSelect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_setConfirmCallback, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, ack_callback)
ZEND_ARG_INFO(0, nack_callback)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_waitForConfirm, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_INFO(0, timeout)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_setReturnCallback, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, return_callback)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_waitForBasicReturn, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_INFO(0, timeout)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_channel_class_getConsumers, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
+ZEND_END_ARG_INFO()
+
//setConfirmsCallback
+
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, 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 TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("connection"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("prefetch_count"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_long(this_ce, ZEND_STRL("prefetch_size"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
+ zend_declare_property_null(this_ce, ZEND_STRL("consumers"), ZEND_ACC_PRIVATE TSRMLS_CC);
+
#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;
}
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/amqp_channel.h b/amqp-1.9.3/amqp_channel.h
similarity index 100%
rename from amqp-1.9.1/amqp_channel.h
rename to amqp-1.9.3/amqp_channel.h
diff --git a/amqp-1.9.1/amqp_connection.c b/amqp-1.9.3/amqp_connection.c
similarity index 100%
rename from amqp-1.9.1/amqp_connection.c
rename to amqp-1.9.3/amqp_connection.c
diff --git a/amqp-1.9.1/amqp_connection.h b/amqp-1.9.3/amqp_connection.h
similarity index 100%
rename from amqp-1.9.1/amqp_connection.h
rename to amqp-1.9.3/amqp_connection.h
diff --git a/amqp-1.9.1/amqp_connection_resource.c b/amqp-1.9.3/amqp_connection_resource.c
similarity index 95%
rename from amqp-1.9.1/amqp_connection_resource.c
rename to amqp-1.9.3/amqp_connection_resource.c
index 133d20b..430d787 100644
--- a/amqp-1.9.1/amqp_connection_resource.c
+++ b/amqp-1.9.3/amqp_connection_resource.c
@@ -1,630 +1,646 @@
/*
+----------------------------------------------------------------------+
| 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 "ext/standard/info.h"
#include "ext/standard/datetime.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
# include "win32/signal.h"
#else
# include <signal.h>
# include <stdint.h>
#endif
#include <amqp.h>
#include <amqp_tcp_socket.h>
#include <amqp_framing.h>
#include <amqp_ssl_socket.h>
#ifdef PHP_WIN32
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
//#include "amqp_basic_properties.h"
#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 TSRMLS_DC);
static void php_amqp_close_connection_from_server(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource TSRMLS_DC);
static void php_amqp_close_channel_from_server(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource, amqp_channel_t channel_id TSRMLS_DC);
/* 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 TSRMLS_DC)
{
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, "Library error: %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 TSRMLS_CC);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED;
}
case AMQP_CHANNEL_CLOSE_METHOD: {
php_amqp_close_channel_from_server(reply, message, resource, channel_id TSRMLS_CC);
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 TSRMLS_DC) {
amqp_connection_close_t *m = (amqp_connection_close_t *)reply.reply.decoded;
int result;
- PHP_AMQP_G(error_code) = m->reply_code;
- spprintf(message, 0, "Server connection error: %d, message: %.*s",
- m->reply_code,
- (PHP5to7_param_str_len_type_t) m->reply_text.len,
- (char *) m->reply_text.bytes
- );
-
+ if (!reply.reply.id) {
+ PHP_AMQP_G(error_code) = -1;
+ spprintf(message, 0, "Server connection error: %d, message: %s",
+ 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,
+ (PHP5to7_param_str_len_type_t) 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 TSRMLS_CC);
}
/* 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 TSRMLS_DC) {
assert(channel_id > 0 && channel_id <= resource->max_slots);
amqp_channel_close_t *m = (amqp_channel_close_t *) reply.reply.decoded;
- PHP_AMQP_G(error_code) = m->reply_code;
- spprintf(message, 0, "Server channel error: %d, message: %.*s",
- m->reply_code,
- (PHP5to7_param_str_len_type_t) m->reply_text.len,
- (char *)m->reply_text.bytes
- );
+ if (!reply.reply.id) {
+ PHP_AMQP_G(error_code) = -1;
+ spprintf(message, 0, "Server channel error: %d, message: %s",
+ 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,
+ (PHP5to7_param_str_len_type_t) 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 TSRMLS_CC);
}
}
}
int php_amqp_connection_resource_error_advanced(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource, amqp_channel_t channel_id, amqp_channel_object *channel TSRMLS_DC)
{
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_id < 0 || AMQP_STATUS_OK != amqp_simple_wait_frame(resource->connection_state, &frame)) {
if (*message != NULL) {
efree(*message);
}
spprintf(message, 0, "Library error: %s", amqp_error_string2(reply.library_error));
return PHP_AMQP_RESOURCE_RESPONSE_ERROR;
}
if (channel_id != frame.channel) {
spprintf(message, 0, "Library error: 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, resource TSRMLS_CC);
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED;
}
case AMQP_CHANNEL_CLOSE_METHOD: {
php_amqp_close_channel_from_server(reply, message, resource, channel_id TSRMLS_CC);
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, resource, channel_id, channel, &frame.payload.method TSRMLS_CC);
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, resource, channel_id, channel, &frame.payload.method TSRMLS_CC);
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, resource, channel_id, channel, &frame.payload.method TSRMLS_CC);
default:
if (*message != NULL) {
efree(*message);
}
spprintf(message, 0, "Library error: 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, "Library error: %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 TSRMLS_DC)
{
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 TSRMLS_CC);
return 0;
}
return 1;
}
int php_amqp_set_resource_write_timeout(amqp_connection_resource *resource, double timeout TSRMLS_DC)
{
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 TSRMLS_CC);
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 = 0; 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, zend_bool persistent TSRMLS_DC)
{
struct timeval tv = {0};
struct timeval *tv_ptr = &tv;
char *std_datetime;
amqp_table_entry_t client_properties_entries[5];
amqp_table_t client_properties_table;
amqp_table_entry_t custom_properties_entries[1];
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 TSRMLS_CC);
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 TSRMLS_CC);
return NULL;
}
}
if (params->cacert && amqp_ssl_socket_set_cacert(resource->socket, params->cacert)) {
zend_throw_exception(amqp_connection_exception_class_entry, "Socket error: could not set CA certificate.", 0 TSRMLS_CC);
return NULL;
}
if (params->cacert) {
#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 && amqp_ssl_socket_set_key(resource->socket, params->cert, params->key)) {
zend_throw_exception(amqp_connection_exception_class_entry, "Socket error: could not setting client cert.", 0 TSRMLS_CC);
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 */
if (amqp_socket_open_noblock(resource->socket, params->host, params->port, tv_ptr)) {
zend_throw_exception(amqp_connection_exception_class_entry, "Socket error: could not connect to host.", 0 TSRMLS_CC);
connection_resource_destructor(resource, persistent TSRMLS_CC);
return NULL;
}
if (!php_amqp_set_resource_read_timeout(resource, params->read_timeout TSRMLS_CC)) {
connection_resource_destructor(resource, persistent TSRMLS_CC);
return NULL;
}
if (!php_amqp_set_resource_write_timeout(resource, params->write_timeout TSRMLS_CC)) {
connection_resource_destructor(resource, persistent TSRMLS_CC);
return NULL;
}
std_datetime = php_std_date(time(NULL) TSRMLS_CC);
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("revision");
client_properties_entries[2].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[2].value.value.bytes = amqp_cstring_bytes(PHP_AMQP_REVISION);
client_properties_entries[3].key = amqp_cstring_bytes("connection type");
client_properties_entries[3].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[3].value.value.bytes = amqp_cstring_bytes(persistent ? "persistent" : "transient");
client_properties_entries[4].key = amqp_cstring_bytes("connection started");
client_properties_entries[4].value.kind = AMQP_FIELD_KIND_UTF8;
client_properties_entries[4].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;
custom_properties_table.entries = custom_properties_entries;
custom_properties_table.num_entries = sizeof(custom_properties_entries) / sizeof(amqp_table_entry_t);
/* 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,
AMQP_SASL_METHOD_PLAIN,
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 TSRMLS_CC);
spprintf(&long_message, 0, "%s - Potential login failure.", message);
zend_throw_exception(amqp_connection_exception_class_entry, long_message, PHP_AMQP_G(error_code) TSRMLS_CC);
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 TSRMLS_CC);
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);
+ 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 *)PHP5to7_ZEND_RESOURCE_DTOR_ARG->ptr;
connection_resource_destructor(resource, 1 TSRMLS_CC);
}
ZEND_RSRC_DTOR_FUNC(amqp_connection_resource_dtor)
{
amqp_connection_resource *resource = (amqp_connection_resource *)PHP5to7_ZEND_RESOURCE_DTOR_ARG->ptr;
connection_resource_destructor(resource, 0 TSRMLS_CC);
}
static void connection_resource_destructor(amqp_connection_resource *resource, int persistent TSRMLS_DC)
{
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 TSRMLS_CC);
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 TSRMLS_DC)
{
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 TSRMLS_CC);
}
}
}
/* 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-1.9.1/amqp_connection_resource.h b/amqp-1.9.3/amqp_connection_resource.h
similarity index 100%
rename from amqp-1.9.1/amqp_connection_resource.h
rename to amqp-1.9.3/amqp_connection_resource.h
diff --git a/amqp-1.9.1/amqp_decimal.c b/amqp-1.9.3/amqp_decimal.c
similarity index 100%
rename from amqp-1.9.1/amqp_decimal.c
rename to amqp-1.9.3/amqp_decimal.c
diff --git a/amqp-1.9.1/amqp_decimal.h b/amqp-1.9.3/amqp_decimal.h
similarity index 100%
rename from amqp-1.9.1/amqp_decimal.h
rename to amqp-1.9.3/amqp_decimal.h
diff --git a/amqp-1.9.1/amqp_envelope.c b/amqp-1.9.3/amqp_envelope.c
similarity index 92%
rename from amqp-1.9.1/amqp_envelope.c
rename to amqp-1.9.3/amqp_envelope.c
index cd5c342..8127bed 100644
--- a/amqp-1.9.1/amqp_envelope.c
+++ b/amqp-1.9.3/amqp_envelope.c
@@ -1,257 +1,271 @@
/*
+----------------------------------------------------------------------+
| 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 "ext/standard/info.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
# include "win32/signal.h"
#else
# include <signal.h>
# include <stdint.h>
#endif
#include <amqp.h>
#include <amqp_framing.h>
#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 TSRMLS_DC)
{
/* 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, envelope, ZEND_STRL("body"), (const char *) message->body.bytes, (PHP5to7_param_str_len_type_t) message->body.len TSRMLS_CC);
+ zend_update_property_stringl(this_ce, envelope, ZEND_STRL("consumer_tag"), (const char *) amqp_envelope->consumer_tag.bytes, (PHP5to7_param_str_len_type_t) amqp_envelope->consumer_tag.len TSRMLS_CC);
zend_update_property_long(this_ce, envelope, ZEND_STRL("delivery_tag"), (PHP5to7_param_long_type_t) amqp_envelope->delivery_tag TSRMLS_CC);
zend_update_property_bool(this_ce, envelope, ZEND_STRL("is_redelivery"), (PHP5to7_param_long_type_t) amqp_envelope->redelivered TSRMLS_CC);
zend_update_property_stringl(this_ce, envelope, ZEND_STRL("exchange_name"), (const char *) amqp_envelope->exchange.bytes, (PHP5to7_param_str_len_type_t) amqp_envelope->exchange.len TSRMLS_CC);
zend_update_property_stringl(this_ce, envelope, ZEND_STRL("routing_key"), (const char *) amqp_envelope->routing_key.bytes, (PHP5to7_param_str_len_type_t) amqp_envelope->routing_key.len TSRMLS_CC);
php_amqp_basic_properties_extract(p, envelope TSRMLS_CC);
}
/* {{{ proto AMQPEnvelope::__construct() */
static PHP_METHOD(amqp_envelope_class, __construct) {
PHP_AMQP_NOPARAMS();
/* BC */
php_amqp_basic_properties_set_empty_headers(getThis() TSRMLS_CC);
}
/* }}} */
/* {{{ proto AMQPEnvelope::getBody()*/
static PHP_METHOD(amqp_envelope_class, getBody) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
zval* zv = PHP_AMQP_READ_THIS_PROP("body");
if (Z_STRLEN_P(zv) == 0) {
/* BC */
RETURN_FALSE;
}
RETURN_ZVAL(zv, 1, 0);
}
/* }}} */
/* {{{ proto AMQPEnvelope::getRoutingKey() */
static PHP_METHOD(amqp_envelope_class, getRoutingKey) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("routing_key");
}
/* }}} */
/* {{{ proto AMQPEnvelope::getDeliveryTag() */
static PHP_METHOD(amqp_envelope_class, getDeliveryTag) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("delivery_tag");
}
/* }}} */
+/* {{{ proto AMQPEnvelope::getConsumerTag() */
+static PHP_METHOD(amqp_envelope_class, getConsumerTag) {
+ PHP5to7_READ_PROP_RV_PARAM_DECL;
+ PHP_AMQP_NOPARAMS();
+ PHP_AMQP_RETURN_THIS_PROP("consumer_tag");
+}
+/* }}} */
+
/* {{{ proto AMQPEnvelope::getExchangeName() */
static PHP_METHOD(amqp_envelope_class, getExchangeName) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("exchange_name");
}
/* }}} */
/* {{{ proto AMQPEnvelope::isRedelivery() */
static PHP_METHOD(amqp_envelope_class, isRedelivery) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("is_redelivery");
}
/* }}} */
/* {{{ proto AMQPEnvelope::getHeader(string name) */
static PHP_METHOD(amqp_envelope_class, getHeader) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
char *key; PHP5to7_param_str_len_type_t key_len;
PHP5to7_zval_t *tmp = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
return;
}
zval* zv = PHP_AMQP_READ_THIS_PROP_CE("headers", amqp_basic_properties_class_entry);
//zval* zv = PHP_AMQP_READ_THIS_PROP("headers");
/* Look for the hash key */
if (!PHP5to7_ZEND_HASH_FIND(HASH_OF(zv), key, key_len + 1, tmp)) {
RETURN_FALSE;
}
RETURN_ZVAL(PHP5to7_MAYBE_DEREF(tmp), 1, 0);
}
/* }}} */
/* {{{ proto AMQPEnvelope::hasHeader(string name) */
static PHP_METHOD(amqp_envelope_class, hasHeader) {
PHP5to7_READ_PROP_RV_PARAM_DECL;
char *key; PHP5to7_param_str_len_type_t key_len;
PHP5to7_zval_t *tmp = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
return;
}
zval* zv = PHP_AMQP_READ_THIS_PROP_CE("headers", amqp_basic_properties_class_entry);
//zval* zv = PHP_AMQP_READ_THIS_PROP("headers");
/* Look for the hash key */
if (!PHP5to7_ZEND_HASH_FIND(HASH_OF(zv), key, key_len + 1, tmp)) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* 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_INFO_EX(arginfo_amqp_envelope_class_getBody, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_getRoutingKey, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_getConsumerTag, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_getDeliveryTag, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_getExchangeName, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_isRedelivery, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_getHeader, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_envelope_class_hasHeader, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, name)
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 PHP5to7_PARENT_CLASS_NAME_C(NULL) TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("body"), ZEND_ACC_PRIVATE TSRMLS_CC);
+ zend_declare_property_null(this_ce, ZEND_STRL("consumer_tag"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("delivery_tag"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("is_redelivery"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("exchange_name"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("routing_key"), ZEND_ACC_PRIVATE TSRMLS_CC);
return SUCCESS;
}
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/amqp_envelope.h b/amqp-1.9.3/amqp_envelope.h
similarity index 100%
rename from amqp-1.9.1/amqp_envelope.h
rename to amqp-1.9.3/amqp_envelope.h
diff --git a/amqp-1.9.1/amqp_exchange.c b/amqp-1.9.3/amqp_exchange.c
similarity index 100%
rename from amqp-1.9.1/amqp_exchange.c
rename to amqp-1.9.3/amqp_exchange.c
diff --git a/amqp-1.9.1/amqp_exchange.h b/amqp-1.9.3/amqp_exchange.h
similarity index 100%
rename from amqp-1.9.1/amqp_exchange.h
rename to amqp-1.9.3/amqp_exchange.h
diff --git a/amqp-1.9.1/amqp_methods_handling.c b/amqp-1.9.3/amqp_methods_handling.c
similarity index 100%
rename from amqp-1.9.1/amqp_methods_handling.c
rename to amqp-1.9.3/amqp_methods_handling.c
diff --git a/amqp-1.9.1/amqp_methods_handling.h b/amqp-1.9.3/amqp_methods_handling.h
similarity index 100%
rename from amqp-1.9.1/amqp_methods_handling.h
rename to amqp-1.9.3/amqp_methods_handling.h
diff --git a/amqp-1.9.1/amqp_queue.c b/amqp-1.9.3/amqp_queue.c
similarity index 89%
rename from amqp-1.9.1/amqp_queue.c
rename to amqp-1.9.3/amqp_queue.c
index 9599aea..897d437 100644
--- a/amqp-1.9.1/amqp_queue.c
+++ b/amqp-1.9.3/amqp_queue.c
@@ -1,1197 +1,1299 @@
/*
+----------------------------------------------------------------------+
| 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 "ext/standard/info.h"
#include "zend_exceptions.h"
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
# include "win32/signal.h"
#else
# include <signal.h>
# include <stdint.h>
#endif
#include <amqp.h>
#include <amqp_framing.h>
#ifdef PHP_WIN32
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
#include "php_amqp.h"
#include "amqp_envelope.h"
#include "amqp_connection.h"
#include "amqp_channel.h"
#include "amqp_queue.h"
#include "amqp_type.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)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP5to7_zval_t arguments PHP5to7_MAYBE_SET_TO_NULL;
zval *channelObj;
amqp_channel_resource *channel_resource;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &channelObj) == FAILURE) {
return;
}
PHP5to7_MAYBE_INIT(arguments);
PHP5to7_ARRAY_INIT(arguments);
zend_update_property(this_ce, getThis(), ZEND_STRL("arguments"), PHP5to7_MAYBE_PTR(arguments) TSRMLS_CC);
- PHP5to7_MAYBE_DESTROY(arguments);
+ PHP5to7_MAYBE_DESTROY(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, getThis(), ZEND_STRL("channel"), channelObj TSRMLS_CC);
zend_update_property(this_ce, getThis(), ZEND_STRL("connection"), PHP_AMQP_READ_OBJ_PROP(amqp_channel_class_entry, channelObj, "connection") TSRMLS_CC);
}
/* }}} */
/* {{{ proto AMQPQueue::getName()
Get the queue name */
static PHP_METHOD(amqp_queue_class, getName)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
if (PHP_AMQP_READ_THIS_PROP_STRLEN("name") > 0) {
PHP_AMQP_RETURN_THIS_PROP("name");
} else {
/* BC */
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto AMQPQueue::setName(string name)
Set the queue name */
static PHP_METHOD(amqp_queue_class, setName)
{
char *name = NULL; PHP5to7_param_str_len_type_t name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
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 TSRMLS_CC);
return;
}
/* Set the queue name */
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("name"), name, name_len TSRMLS_CC);
/* BC */
RETURN_TRUE;
}
/* }}} */
/* {{{ proto AMQPQueue::getFlags()
Get the queue parameters */
static PHP_METHOD(amqp_queue_class, getFlags)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP5to7_param_long_type_t flagBitmask = 0;
PHP_AMQP_NOPARAMS();
if (PHP_AMQP_READ_THIS_PROP_BOOL("passive")) {
flagBitmask |= AMQP_PASSIVE;
}
if (PHP_AMQP_READ_THIS_PROP_BOOL("durable")) {
flagBitmask |= AMQP_DURABLE;
}
if (PHP_AMQP_READ_THIS_PROP_BOOL("exclusive")) {
flagBitmask |= AMQP_EXCLUSIVE;
}
if (PHP_AMQP_READ_THIS_PROP_BOOL("auto_delete")) {
flagBitmask |= AMQP_AUTODELETE;
}
RETURN_LONG(flagBitmask);
}
/* }}} */
/* {{{ proto AMQPQueue::setFlags(long bitmask)
Set the queue parameters */
static PHP_METHOD(amqp_queue_class, setFlags)
{
PHP5to7_param_long_type_t flagBitmask;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flagBitmask) == FAILURE) {
return;
}
/* Set the flags based on the bitmask we were given */
flagBitmask = flagBitmask ? flagBitmask & PHP_AMQP_QUEUE_FLAGS : flagBitmask;
zend_update_property_bool(this_ce, getThis(), ZEND_STRL("passive"), IS_PASSIVE(flagBitmask) TSRMLS_CC);
zend_update_property_bool(this_ce, getThis(), ZEND_STRL("durable"), IS_DURABLE(flagBitmask) TSRMLS_CC);
zend_update_property_bool(this_ce, getThis(), ZEND_STRL("exclusive"), IS_EXCLUSIVE(flagBitmask) TSRMLS_CC);
zend_update_property_bool(this_ce, getThis(), ZEND_STRL("auto_delete"), IS_AUTODELETE(flagBitmask) TSRMLS_CC);
/* BC */
RETURN_TRUE;
}
/* }}} */
/* {{{ proto AMQPQueue::getArgument(string key)
Get the queue argument referenced by key */
static PHP_METHOD(amqp_queue_class, getArgument)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP5to7_zval_t *tmp = NULL;
char *key; PHP5to7_param_str_len_type_t key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
return;
}
if (!PHP5to7_ZEND_HASH_FIND(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, (uint)(key_len + 1), tmp)) {
RETURN_FALSE;
}
RETURN_ZVAL(PHP5to7_MAYBE_DEREF(tmp), 1, 0);
}
/* }}} */
/* {{{ proto AMQPQueue::hasArgument(string key) */
static PHP_METHOD(amqp_queue_class, hasArgument)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP5to7_zval_t *tmp = NULL;
char *key; PHP5to7_param_str_len_type_t key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
return;
}
if (!PHP5to7_ZEND_HASH_FIND(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, (uint)(key_len + 1), tmp)) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto AMQPQueue::getArguments
Get the queue arguments */
static PHP_METHOD(amqp_queue_class, getArguments)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
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() TSRMLS_CC, "a/", &zvalArguments) == FAILURE) {
return;
}
zend_update_property(this_ce, getThis(), ZEND_STRL("arguments"), zvalArguments TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto AMQPQueue::setArgument(key, value)
Get the queue name */
static PHP_METHOD(amqp_queue_class, setArgument)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
char *key= NULL; PHP5to7_param_str_len_type_t key_len = 0;
zval *value = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
&key, &key_len,
&value) == FAILURE) {
return;
}
switch (Z_TYPE_P(value)) {
case IS_NULL:
PHP5to7_ZEND_HASH_DEL(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, (uint) (key_len + 1));
break;
PHP5to7_CASE_IS_BOOL:
case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
PHP5to7_ZEND_HASH_ADD(PHP_AMQP_READ_THIS_PROP_ARR("arguments"), key, (uint) (key_len + 1), value, sizeof(zval *));
Z_TRY_ADDREF_P(value);
break;
default:
zend_throw_exception(amqp_exchange_exception_class_entry, "The value parameter must be of type NULL, int, double or string.", 0 TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::declareQueue();
declare queue
*/
static PHP_METHOD(amqp_queue_class, declareQueue)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
char *name;
amqp_table_t *arguments;
PHP5to7_param_long_type_t message_count;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
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") TSRMLS_CC);
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_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("auto_delete"),
*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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
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, getThis(), ZEND_STRL("name"), name TSRMLS_CC);
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)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
zval *zvalArguments = NULL;
amqp_channel_resource *channel_resource;
char *exchange_name; PHP5to7_param_str_len_type_t exchange_name_len;
char *keyname = NULL; PHP5to7_param_str_len_type_t keyname_len = 0;
amqp_table_t *arguments = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sa",
&exchange_name, &exchange_name_len,
&keyname, &keyname_len,
&zvalArguments) == FAILURE) {
return;
}
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 TSRMLS_CC);
}
amqp_queue_bind(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::get([bit flags=AMQP_NOPARAM]);
read messages from queue
return array (messages)
*/
static PHP_METHOD(amqp_queue_class, get)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
PHP5to7_zval_t message PHP5to7_MAYBE_SET_TO_NULL;
PHP5to7_zval_t retval PHP5to7_MAYBE_SET_TO_NULL;
PHP5to7_param_long_type_t flags = INI_INT("amqp.auto_ack") ? AMQP_AUTOACK : AMQP_NOPARAM;
/* Parse out the method parameters */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
return;
}
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_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 TSRMLS_CC);
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_FALSE;
}
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 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
amqp_destroy_envelope(&envelope);
return;
}
PHP5to7_MAYBE_INIT(message);
convert_amqp_envelope_to_zval(&envelope, PHP5to7_MAYBE_PTR(message) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
amqp_destroy_envelope(&envelope);
RETVAL_ZVAL(PHP5to7_MAYBE_PTR(message), 1, 0);
PHP5to7_MAYBE_DESTROY(message);
}
/* }}} */
/* {{{ proto array AMQPQueue::consume([callback, flags = <bitmask>, consumer_tag]);
consume the message
*/
static PHP_METHOD(amqp_queue_class, consume)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
+ PHP5to7_zval_t *consumer_tag_zv = NULL;
+ PHP5to7_zval_t current_channel_zv PHP5to7_MAYBE_SET_TO_NULL;
+
+ PHP5to7_zval_t *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; PHP5to7_param_str_len_type_t consumer_tag_len = 0;
PHP5to7_param_long_type_t flags = INI_INT("amqp.auto_ack") ? AMQP_AUTOACK : AMQP_NOPARAM;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|f!ls",
&fci, &fci_cache,
&flags,
&consumer_tag, &consumer_tag_len) == FAILURE) {
return;
}
- amqp_channel_object *channel = PHP_AMQP_GET_CHANNEL(PHP_AMQP_READ_THIS_PROP("channel"));
+ zval *channel_zv = PHP_AMQP_READ_THIS_PROP("channel");
+ zval *consumers = zend_read_property(amqp_channel_class_entry, channel_zv, ZEND_STRL("consumers"), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC);
- channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
+ if (IS_ARRAY != Z_TYPE_P(consumers)) {
+ zend_throw_exception(amqp_queue_exception_class_entry, "Invalid channel consumers, forgot to call channel constructor?", 0 TSRMLS_CC);
+ return;
+ }
+
+ 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)) {
/* Setup the consume */
arguments = php_amqp_type_convert_zval_to_amqp_table(PHP_AMQP_READ_THIS_PROP("arguments") TSRMLS_CC);
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_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 TSRMLS_CC);
zend_throw_exception(amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
+ char *key;
+ key = estrndup((char *) r->consumer_tag.bytes, (uint) r->consumer_tag.len);
+
+ if (PHP5to7_ZEND_HASH_FIND(Z_ARRVAL_P(consumers), (const char *) key, PHP5to7_ZEND_HASH_STRLEN(r->consumer_tag.len), consumer_tag_zv)) {
+ // 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 TSRMLS_CC);
+ efree(key);
+ return;
+ }
+
+ PHP5to7_zval_t tmp PHP5to7_MAYBE_SET_TO_NULL;
+
+#if PHP_MAJOR_VERSION >= 7
+ PHP5to7_MAYBE_INIT(tmp);
+ ZVAL_COPY(PHP5to7_MAYBE_PTR(tmp), getThis());
+#else
+ tmp = getThis();
+ Z_ADDREF_P(tmp);
+#endif
+
+ PHP5to7_ZEND_HASH_ADD(Z_ARRVAL_P(consumers),
+ (const char *) key,
+ PHP5to7_ZEND_HASH_STRLEN(r->consumer_tag.len),
+ PHP5to7_MAYBE_PTR(tmp),
+ sizeof(PHP5to7_MAYBE_PTR_TYPE)
+ );
+
+ efree(key);
+
/* Set the consumer tag name, in case it is an autogenerated consumer tag name */
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("consumer_tag"), (const char *) r->consumer_tag.bytes, (PHP5to7_param_str_len_type_t) r->consumer_tag.len TSRMLS_CC);
}
if (!ZEND_FCI_INITIALIZED(fci)) {
/* Callback not set, we have nothing to do - real consuming may happens 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"), "read_timeout");
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 */
PHP5to7_zval_t message PHP5to7_MAYBE_SET_TO_NULL;
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_LIBRARY_EXCEPTION == res.reply_type && AMQP_STATUS_TIMEOUT == res.library_error) {
zend_throw_exception(amqp_queue_exception_class_entry, "Consumer timeout exceed", 0 TSRMLS_CC);
amqp_destroy_envelope(&envelope);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
if (PHP_AMQP_MAYBE_ERROR_RECOVERABLE(res, channel_resource)) {
if (PHP_AMQP_IS_ERROR_RECOVERABLE(res, channel_resource, channel)) {
/* In case no message was received, continue the loop */
amqp_destroy_envelope(&envelope);
continue;
} else {
/* Mark connection resource as closed to prevent sending any further requests */
channel_resource->connection_resource->is_connected = '\0';
/* Close connection with all its channels */
php_amqp_disconnect_force(channel_resource->connection_resource TSRMLS_CC);
}
php_amqp_zend_throw_exception_short(res, amqp_queue_exception_class_entry TSRMLS_CC);
amqp_destroy_envelope(&envelope);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
PHP5to7_MAYBE_INIT(message);
convert_amqp_envelope_to_zval(&envelope, PHP5to7_MAYBE_PTR(message) TSRMLS_CC);
+ 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 TSRMLS_CC);
+ amqp_destroy_envelope(&envelope);
+ break;
+ }
+
+#if PHP_MAJOR_VERSION >= 7
+ PHP5to7_MAYBE_INIT(current_channel_zv);
+ ZVAL_OBJ(&current_channel_zv, &current_channel_resource->parent->zo);
+#else
+ current_channel_zv = current_channel_resource->parent->this_ptr;
+#endif
+
+ consumers = zend_read_property(amqp_channel_class_entry, PHP5to7_MAYBE_PTR(current_channel_zv), ZEND_STRL("consumers"), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC);
+
+ if (IS_ARRAY != Z_TYPE_P(consumers)) {
+ zend_throw_exception(amqp_queue_exception_class_entry, "Invalid channel consumers, forgot to call channel constructor?", 0 TSRMLS_CC);
+ amqp_destroy_envelope(&envelope);
+ break;
+ }
+
+ char *key;
+ key = estrndup((char *)envelope.consumer_tag.bytes, (uint) envelope.consumer_tag.len);
+
+ if (!PHP5to7_ZEND_HASH_FIND(Z_ARRVAL_P(consumers), key, PHP5to7_ZEND_HASH_STRLEN(envelope.consumer_tag.len), current_queue_zv)) {
+ PHP5to7_zval_t exception PHP5to7_MAYBE_SET_TO_NULL;
+ PHP5to7_MAYBE_INIT(exception);
+ object_init_ex(PHP5to7_MAYBE_PTR(exception), amqp_envelope_exception_class_entry);
+ zend_update_property_string(zend_exception_get_default(TSRMLS_C), PHP5to7_MAYBE_PTR(exception), ZEND_STRL("message"), "Orphaned envelope" TSRMLS_CC);
+ zend_update_property(amqp_envelope_exception_class_entry, PHP5to7_MAYBE_PTR(exception), ZEND_STRL("envelope"), PHP5to7_MAYBE_PTR(message) TSRMLS_CC);
+
+ zend_throw_exception_object(PHP5to7_MAYBE_PTR(exception) TSRMLS_CC);
+
+ PHP5to7_MAYBE_DESTROY(message);
+
+ amqp_destroy_envelope(&envelope);
+ efree(key);
+ break;
+ }
+
+ efree(key);
amqp_destroy_envelope(&envelope);
/* Make the callback */
PHP5to7_zval_t params PHP5to7_MAYBE_SET_TO_NULL;
PHP5to7_zval_t retval PHP5to7_MAYBE_SET_TO_NULL;
/* Build the parameter array */
PHP5to7_MAYBE_INIT(params);
PHP5to7_ARRAY_INIT(params);
/* Dump it into the params array */
add_index_zval(PHP5to7_MAYBE_PTR(params), 0, PHP5to7_MAYBE_PTR(message));
Z_ADDREF_P( PHP5to7_MAYBE_PTR(message));
/* Add a pointer to the queue: */
- add_index_zval(PHP5to7_MAYBE_PTR(params), 1, getThis());
- Z_ADDREF_P(getThis());
+ add_index_zval(PHP5to7_MAYBE_PTR(params), 1, PHP5to7_MAYBE_DEREF(current_queue_zv));
+ Z_ADDREF_P(PHP5to7_MAYBE_DEREF(current_queue_zv));
+
/* Convert everything to be callable */
zend_fcall_info_args(&fci, PHP5to7_MAYBE_PTR(params) TSRMLS_CC);
/* Initialize the return value pointer */
PHP5to7_SET_FCI_RETVAL_PTR(fci, PHP5to7_MAYBE_PTR(retval));
/* Call the function, and track the return value */
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && PHP5to7_CHECK_FCI_RETVAL_PTR(fci)) {
RETVAL_ZVAL(PHP5to7_MAYBE_PTR(retval), 1, 1);
}
/* Clean up our mess */
zend_fcall_info_args_clear(&fci, 1);
PHP5to7_MAYBE_DESTROY(params);
PHP5to7_MAYBE_DESTROY(message);
/* Check if user land function wants to bail */
if (EG(exception) || PHP5to7_IS_FALSE_P(return_value)) {
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)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t deliveryTag = 0;
PHP5to7_param_long_type_t flags = AMQP_NOPARAM;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &deliveryTag, &flags ) == FAILURE) {
return;
}
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::nack(long deliveryTag, [bit flags=AMQP_NOPARAM]);
acknowledge the message
*/
static PHP_METHOD(amqp_queue_class, nack)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t deliveryTag = 0;
PHP5to7_param_long_type_t flags = AMQP_NOPARAM;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &deliveryTag, &flags ) == FAILURE) {
return;
}
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::reject(long deliveryTag, [bit flags=AMQP_NOPARAM]);
acknowledge the message
*/
static PHP_METHOD(amqp_queue_class, reject)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t deliveryTag = 0;
PHP5to7_param_long_type_t flags = AMQP_NOPARAM;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &deliveryTag, &flags) == FAILURE) {
return;
}
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::purge();
purge queue
*/
static PHP_METHOD(amqp_queue_class, purge)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
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_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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
/* long message_count = r->message_count; */
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
/* RETURN_LONG(message_count) */;
/* BC */
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::cancel([string consumer_tag]);
cancel queue to consumer
*/
static PHP_METHOD(amqp_queue_class, cancel)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
+ PHP5to7_zval_t *tmp = NULL;
char *consumer_tag = NULL; PHP5to7_param_str_len_type_t consumer_tag_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &consumer_tag, &consumer_tag_len) == FAILURE) {
return;
}
- channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(PHP_AMQP_READ_THIS_PROP("channel"));
+ zval *channel_zv = PHP_AMQP_READ_THIS_PROP("channel");
+ zval *consumers = zend_read_property(amqp_channel_class_entry, channel_zv, ZEND_STRL("consumers"), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC);
+
+ if (IS_ARRAY != Z_TYPE_P(consumers)) {
+ zend_throw_exception(amqp_queue_exception_class_entry, "Invalid channel consumers, forgot to call channel constructor?", 0 TSRMLS_CC);
+ return;
+ }
+
+ channel_resource = PHP_AMQP_GET_CHANNEL_RESOURCE(channel_zv);
PHP_AMQP_VERIFY_CHANNEL_RESOURCE(channel_resource, "Could not cancel queue.");
- if (!consumer_tag_len && !PHP_AMQP_READ_THIS_PROP_STRLEN("consumer_tag")) {
- return;
- }
+ if (!consumer_tag_len && !PHP_AMQP_READ_THIS_PROP_STRLEN("consumer_tag")) {
+ 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("consumer_tag"))
);
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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
return;
}
if (!consumer_tag_len || strcmp(consumer_tag, PHP_AMQP_READ_THIS_PROP_STR("consumer_tag")) != 0) {
zend_update_property_null(this_ce, getThis(), ZEND_STRL("consumer_tag") TSRMLS_CC);
}
- php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
+ char *key;
+ key = estrndup((char *)r->consumer_tag.bytes, (uint) r->consumer_tag.len);
+ PHP5to7_ZEND_HASH_DEL(Z_ARRVAL_P(consumers), (const char *) key, PHP5to7_ZEND_HASH_STRLEN(r->consumer_tag.len));
+ efree(key);
+
+ php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int AMQPQueue::unbind(string exchangeName, [string routingKey, array arguments]);
unbind queue from exchange
*/
static PHP_METHOD(amqp_queue_class, unbind)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
zval *zvalArguments = NULL;
amqp_channel_resource *channel_resource;
char *exchange_name; PHP5to7_param_str_len_type_t exchange_name_len;
char *keyname = NULL; PHP5to7_param_str_len_type_t keyname_len = 0;
amqp_table_t *arguments = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sa",
&exchange_name, &exchange_name_len,
&keyname, &keyname_len,
&zvalArguments) == FAILURE) {
return;
}
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 TSRMLS_CC);
}
amqp_queue_unbind(
channel_resource->connection_resource->connection_state,
channel_resource->channel_id,
amqp_cstring_bytes(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 TSRMLS_CC);
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_TRUE;
}
/* }}} */
/* {{{ 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)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t flags = AMQP_NOPARAM;
PHP5to7_param_long_type_t message_count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
return;
}
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_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 TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_queue_exception_class_entry, PHP_AMQP_G(error_message), PHP_AMQP_G(error_code) TSRMLS_CC);
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)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
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)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("connection");
}
/* }}} */
/* {{{ proto string AMQPChannel::getConsumerTag()
Get latest consumer tag*/
static PHP_METHOD(amqp_queue_class, getConsumerTag)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("consumer_tag");
}
/* }}} */
/* 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, amqp_channel, AMQPChannel, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getName, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_setName, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, queue_name)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getFlags, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_setFlags, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getArgument, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, argument)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getArguments, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_setArgument, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2)
ZEND_ARG_INFO(0, key)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_hasArgument, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, key)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_setArguments, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_ARRAY_INFO(0, arguments, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_declareQueue, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_bind, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, exchange_name)
ZEND_ARG_INFO(0, routing_key)
ZEND_ARG_INFO(0, arguments)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_get, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_consume, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, callback)
ZEND_ARG_INFO(0, flags)
ZEND_ARG_INFO(0, consumer_tag)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_ack, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, delivery_tag)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_nack, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, delivery_tag)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_reject, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, delivery_tag)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_purge, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_cancel, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_INFO(0, consumer_tag)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_unbind, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, exchange_name)
ZEND_ARG_INFO(0, routing_key)
ZEND_ARG_INFO(0, arguments)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_delete, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getChannel, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getConnection, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_queue_class_getConsumerTag, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
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, 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_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, 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)
PHP_MALIAS(amqp_queue_class, declare, declareQueue, arginfo_amqp_queue_class_declareQueue, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED)
{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 TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("connection"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("channel"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_stringl(this_ce, ZEND_STRL("name"), "", 0, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("consumer_tag"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_bool(this_ce, ZEND_STRL("passive"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_bool(this_ce, ZEND_STRL("durable"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_bool(this_ce, ZEND_STRL("exclusive"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
/* By default, the auto_delete flag should be set */
zend_declare_property_bool(this_ce, ZEND_STRL("auto_delete"), 1, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("arguments"), ZEND_ACC_PRIVATE TSRMLS_CC);
return SUCCESS;
}
/*
*Local variables:
*tab-width: 4
*tabstop: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/amqp_queue.h b/amqp-1.9.3/amqp_queue.h
similarity index 100%
rename from amqp-1.9.1/amqp_queue.h
rename to amqp-1.9.3/amqp_queue.h
diff --git a/amqp-1.9.1/amqp_timestamp.c b/amqp-1.9.3/amqp_timestamp.c
similarity index 100%
rename from amqp-1.9.1/amqp_timestamp.c
rename to amqp-1.9.3/amqp_timestamp.c
diff --git a/amqp-1.9.1/amqp_timestamp.h b/amqp-1.9.3/amqp_timestamp.h
similarity index 100%
rename from amqp-1.9.1/amqp_timestamp.h
rename to amqp-1.9.3/amqp_timestamp.h
diff --git a/amqp-1.9.1/amqp_type.c b/amqp-1.9.3/amqp_type.c
similarity index 100%
rename from amqp-1.9.1/amqp_type.c
rename to amqp-1.9.3/amqp_type.c
diff --git a/amqp-1.9.1/amqp_type.h b/amqp-1.9.3/amqp_type.h
similarity index 100%
rename from amqp-1.9.1/amqp_type.h
rename to amqp-1.9.3/amqp_type.h
diff --git a/amqp-1.9.1/benchmark.php b/amqp-1.9.3/benchmark.php
similarity index 100%
rename from amqp-1.9.1/benchmark.php
rename to amqp-1.9.3/benchmark.php
diff --git a/amqp-1.9.1/config.m4 b/amqp-1.9.3/config.m4
similarity index 100%
rename from amqp-1.9.1/config.m4
rename to amqp-1.9.3/config.m4
diff --git a/amqp-1.9.1/config.w32 b/amqp-1.9.3/config.w32
similarity index 100%
rename from amqp-1.9.1/config.w32
rename to amqp-1.9.3/config.w32
diff --git a/amqp-1.9.1/php5_support.h b/amqp-1.9.3/php5_support.h
similarity index 98%
rename from amqp-1.9.1/php5_support.h
rename to amqp-1.9.3/php5_support.h
index 37a7557..91bd87e 100644
--- a/amqp-1.9.1/php5_support.h
+++ b/amqp-1.9.3/php5_support.h
@@ -1,119 +1,121 @@
/*
+----------------------------------------------------------------------+
| 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_PHP5_SUPPORT_H
#define PHP_AMQP_PHP5_SUPPORT_H
typedef int PHP5to7_param_str_len_type_t;
typedef long PHP5to7_param_long_type_t;
typedef zval* PHP5to7_zval_t;
#define PHP5to7_MAYBE_SET_TO_NULL = NULL
#define PHP5to7_MAYBE_DEREF(zv) (*(zv))
#define PHP5to7_MAYBE_PTR(zv) (zv)
+#define PHP5to7_MAYBE_PTR_TYPE PHP5to7_zval_t
#define PHP5to7_MAYBE_PARAM_PTR(zv) (&(zv))
#define PHP5to7_MAYBE_INIT(zv) MAKE_STD_ZVAL(zv);
#define PHP5to7_ARRAY_INIT(zv) array_init(zv);
#define PHP5to7_MAYBE_DESTROY(zv) zval_ptr_dtor(&(zv));
#define PHP5to7_MAYBE_DESTROY2(zv, pzv) zval_ptr_dtor(&pzv);
#define PHP5to7_ZVAL_STRINGL_DUP(z, s, l) ZVAL_STRINGL((z), (s), (l), 1)
#define PHP5to7_ADD_NEXT_INDEX_STRINGL_DUP(arg, str, length) add_next_index_stringl((arg), (str), (uint)(length), 1)
#define PHP5to7_ZEND_HASH_FIND(ht, str, len, res) \
(zend_hash_find((ht), (str), (uint)(len), (void **) &(res)) != FAILURE)
+#define PHP5to7_ZEND_HASH_STRLEN(len) (uint)((len) + 1)
#define PHP5to7_ZEND_HASH_DEL(ht, key, len) zend_hash_del_key_or_index((ht), (key), (uint)(len), 0, HASH_DEL_KEY);
#define PHP5to7_ZEND_HASH_ADD(ht, key, len, pData, nDataSize) (zend_hash_add((ht), (key), (uint)(len), &(pData), nDataSize, NULL) != FAILURE)
#define PHP5to7_ZEND_HASH_STR_UPD_MEM(ht, key, len, pData, nDataSize) PHP5to7_ZEND_HASH_ADD((ht), (key), (len), (pData), (nDataSize))
#define PHP5to7_ZEND_HASH_STR_FIND_PTR(ht, key, len, res) PHP5to7_ZEND_HASH_FIND((ht), (key), (len), (res))
#define PHP5to7_ZEND_HASH_STR_DEL(ht, key, len) PHP5to7_ZEND_HASH_DEL((ht), (key), (len))
#define PHP5to7_SET_FCI_RETVAL_PTR(fci, pzv) (fci).retval_ptr_ptr = &(pzv);
#define PHP5to7_CHECK_FCI_RETVAL_PTR(fci) ((fci).retval_ptr_ptr && *(fci).retval_ptr_ptr)
#define PHP5to7_IS_FALSE_P(pzv) ((Z_TYPE_P(pzv) == IS_BOOL && !Z_BVAL_P(pzv)))
#define PHP5to7_obj_free_zend_object void
#define PHP5to7_zend_object_value zend_object_value
#define PHP5to7_zend_register_internal_class_ex(ce, parent_ce) zend_register_internal_class_ex((ce), (parent_ce), NULL TSRMLS_CC)
#define PHP5to7_ECALLOC_CONNECTION_OBJECT(ce) (amqp_connection_object*)ecalloc(1, sizeof(amqp_connection_object))
#define PHP5to7_ECALLOC_CHANNEL_OBJECT(ce) (amqp_channel_object*)ecalloc(1, sizeof(amqp_channel_object))
#define PHP5to7_CASE_IS_BOOL case IS_BOOL
#define PHP5to7_READ_PROP_RV_PARAM_DECL
#define PHP5to7_READ_PROP_RV_PARAM_CC
#define PHP5to7_ZEND_REAL_HASH_KEY_T void
#define PHP5to7_ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, real_key, key, key_len, data, val, pos) \
for ( \
zend_hash_internal_pointer_reset_ex((ht), &(pos)); \
zend_hash_get_current_data_ex((ht), (void**) &(data), &(pos)) == SUCCESS && ((value) = *(data)); \
zend_hash_move_forward_ex((ht), &(pos)) \
)
#define PHP5to7_ZEND_HASH_KEY_IS_STRING(ht, real_key, key, key_len, num_key, pos) \
(zend_hash_get_current_key_ex((ht), &(key), &(key_len), &(num_key), 0, &(pos)) == HASH_KEY_IS_STRING)
#define PHP5to7_ZEND_HASH_KEY_MAYBE_UNPACK(real_key, key, key_len)
#define PHP5to7_ZEND_HASH_FOREACH_END()
#define Z_TRY_ADDREF_P(pz) Z_ADDREF_P(pz)
/* Resources stuff */
typedef int PHP5to7_zend_resource_t;
typedef zend_rsrc_list_entry PHP5to7_zend_resource_store_t;
typedef zend_rsrc_list_entry PHP5to7_zend_resource_le_t;
#define PHP5to7_ZEND_RESOURCE_DTOR_ARG rsrc
#define Z_RES_P(le) (le)
#define PHP5to7_ZEND_RESOURCE_EMPTY 0
#define PHP5to7_ZEND_RESOURCE_LE_EMPTY NULL
#define PHP5to7_ZEND_RSRC_TYPE_P(le) Z_TYPE_P(le)
#define PHP5to7_ZEND_REGISTER_RESOURCE(rsrc_pointer, rsrc_type) ZEND_REGISTER_RESOURCE(NULL, (rsrc_pointer), (rsrc_type))
#define PHP5to7_PARENT_CLASS_NAME_C(name) , (name)
#define ZEND_ULONG_FMT "%" PRIu64
#define PHP5to7_ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL_CLASS
#endif //PHP_AMQP_PHP5_SUPPORT_H
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/php7_support.h b/amqp-1.9.3/php7_support.h
similarity index 96%
rename from amqp-1.9.1/php7_support.h
rename to amqp-1.9.3/php7_support.h
index a955b66..075994b 100644
--- a/amqp-1.9.1/php7_support.h
+++ b/amqp-1.9.3/php7_support.h
@@ -1,111 +1,113 @@
/*
+----------------------------------------------------------------------+
| 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_PHP7_SUPPORT_H
#define PHP_AMQP_PHP7_SUPPORT_H
typedef size_t PHP5to7_param_str_len_type_t;
typedef zend_long PHP5to7_param_long_type_t;
typedef zval PHP5to7_zval_t;
#define PHP5to7_MAYBE_SET_TO_NULL
#define PHP5to7_MAYBE_DEREF(zv) (zv)
#define PHP5to7_MAYBE_PTR(zv) (&(zv))
+#define PHP5to7_MAYBE_PTR_TYPE PHP5to7_zval_t *
#define PHP5to7_MAYBE_PARAM_PTR(zv) (zv)
-#define PHP5to7_MAYBE_INIT(zv)
+#define PHP5to7_MAYBE_INIT(zv) ZVAL_UNDEF(&(zv))
#define PHP5to7_ARRAY_INIT(zv) array_init(&(zv));
#define PHP5to7_MAYBE_DESTROY(zv) if (!Z_ISUNDEF(zv)) { zval_ptr_dtor(&(zv)); }
#define PHP5to7_MAYBE_DESTROY2(zv, pzv) if (!Z_ISUNDEF(zv)) { zval_ptr_dtor(pzv); }
#define PHP5to7_ZVAL_STRINGL_DUP(z, s, l) ZVAL_STRINGL((z), (s), (l))
#define PHP5to7_ADD_NEXT_INDEX_STRINGL_DUP(arg, str, length) add_next_index_stringl((arg), (str), (size_t)(length))
#define PHP5to7_ZEND_HASH_FIND(ht, str, len, res) \
((res = zend_hash_str_find((ht), (str), (size_t)(len - 1))) != NULL)
+#define PHP5to7_ZEND_HASH_STRLEN(len) (PHP5to7_param_str_len_type_t)((len) + 1)
#define PHP5to7_ZEND_HASH_DEL(ht, key, len) zend_hash_str_del_ind((ht), (key), (uint)(len - 1))
#define PHP5to7_ZEND_HASH_ADD(ht, key, len, pData, nDataSize) zend_hash_str_add((ht), (key), (uint)(len - 1), (pData))
#define PHP5to7_ZEND_HASH_STR_UPD_MEM(ht, key, len, pData, nDataSize) zend_hash_str_update_mem((ht), (key), (size_t)(len), &(pData), (nDataSize))
#define PHP5to7_ZEND_HASH_STR_FIND_PTR(ht, key, len, res) ((res = zend_hash_str_find_ptr((ht), (key), (size_t)(len))) != NULL)
#define PHP5to7_ZEND_HASH_STR_DEL(ht, key, len) zend_hash_str_del_ind((ht), (key), (uint)(len))
#define PHP5to7_SET_FCI_RETVAL_PTR(fci, pzv) (fci).retval = (pzv);
#define PHP5to7_CHECK_FCI_RETVAL_PTR(fci) ((fci).retval)
#define PHP5to7_IS_FALSE_P(pzv) (Z_TYPE_P(pzv) == IS_FALSE)
#define PHP5to7_obj_free_zend_object zend_object
#define PHP5to7_zend_object_value zend_object *
#define PHP5to7_zend_register_internal_class_ex(ce, parent_ce) zend_register_internal_class_ex((ce), (parent_ce) TSRMLS_CC)
#define PHP5to7_ECALLOC_CONNECTION_OBJECT(ce) (amqp_connection_object*)ecalloc(1, sizeof(amqp_connection_object) + zend_object_properties_size(ce))
#define PHP5to7_ECALLOC_CHANNEL_OBJECT(ce) (amqp_channel_object*)ecalloc(1, sizeof(amqp_channel_object) + zend_object_properties_size(ce))
#define PHP5to7_CASE_IS_BOOL case IS_TRUE: case IS_FALSE
#define PHP5to7_READ_PROP_RV_PARAM_DECL zval rv;
#define PHP5to7_READ_PROP_RV_PARAM_CC , (&rv)
#define Z_BVAL_P(zval_p) (Z_TYPE_P(zval_p) == IS_TRUE)
#define PHP5to7_ZEND_REAL_HASH_KEY_T zend_string
#define PHP5to7_ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, real_key, key, key_len, data, val, pos) \
ZEND_HASH_FOREACH_KEY_VAL((ht), (num_key), (real_key), (val))
#define PHP5to7_ZEND_HASH_KEY_IS_STRING(ht, real_key, key, key_len, num_key, pos) \
(real_key)
#define PHP5to7_ZEND_HASH_KEY_MAYBE_UNPACK(real_key, key, key_len) \
(key_len) = ZSTR_LEN(real_key); \
(key) = ZSTR_VAL(real_key);
#define PHP5to7_ZEND_HASH_FOREACH_END() ZEND_HASH_FOREACH_END();
/* Resources stuff */
typedef zend_resource* PHP5to7_zend_resource_t;
typedef zend_resource PHP5to7_zend_resource_store_t;
typedef zval PHP5to7_zend_resource_le_t;
#define PHP5to7_ZEND_RESOURCE_DTOR_ARG res
#define PHP5to7_ZEND_RESOURCE_EMPTY NULL
#define PHP5to7_ZEND_RESOURCE_LE_EMPTY NULL
#define PHP5to7_ZEND_RSRC_TYPE_P(le) (le)->type
#define PHP5to7_ZEND_REGISTER_RESOURCE(rsrc_pointer, rsrc_type) zend_register_resource((rsrc_pointer), (rsrc_type))
#define PHP5to7_PARENT_CLASS_NAME_C(name)
#define PHP5to7_ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL
#endif //PHP_AMQP_PHP7_SUPPORT_H
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/php_amqp.h b/amqp-1.9.3/php_amqp.h
similarity index 99%
rename from amqp-1.9.1/php_amqp.h
rename to amqp-1.9.3/php_amqp.h
index 663701e..1467769 100644
--- a/amqp-1.9.1/php_amqp.h
+++ b/amqp-1.9.3/php_amqp.h
@@ -1,385 +1,388 @@
/*
+----------------------------------------------------------------------+
| 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
/* 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_envelope_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 PHP_MAJOR_VERSION >= 7
#include "php7_support.h"
#else
#include "php5_support.h"
#endif
#include "amqp_connection_resource.h"
#include <amqp.h>
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
#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 {
#if PHP_MAJOR_VERSION >= 7
amqp_channel_callbacks callbacks;
zval *gc_data;
int gc_data_count;
amqp_channel_resource *channel_resource;
zend_object zo;
#else
zend_object zo;
+ zval *this_ptr;
amqp_channel_resource *channel_resource;
amqp_channel_callbacks callbacks;
zval **gc_data;
long gc_data_count;
#endif
};
struct _amqp_connection_resource {
zend_bool is_connected;
zend_bool is_persistent;
zend_bool is_dirty;
PHP5to7_zend_resource_t 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 {
#if PHP_MAJOR_VERSION >= 7
amqp_connection_resource *connection_resource;
zend_object zo;
#else
zend_object zo;
amqp_connection_resource *connection_resource;
#endif
};
#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_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"
/* 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 INT_MAX
#define PHP_AMQP_MAX_HEARTBEAT INT_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 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 IS_NOWAIT(bitmask) (AMQP_NOWAIT & (bitmask)) ? 1 : 0 /* NOTE: always 0 in rabbitmq-c internals, so don't use it unless you are clearly understand aftermath*/
#define PHP_AMQP_NOPARAMS() if (zend_parse_parameters_none() == FAILURE) { return; }
#define PHP_AMQP_RETURN_THIS_PROP(prop_name) \
zval * _zv = zend_read_property(this_ce, getThis(), ZEND_STRL(prop_name), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC); \
RETURN_ZVAL(_zv, 1, 0);
#define PHP_AMQP_READ_OBJ_PROP(cls, obj, name) zend_read_property((cls), (obj), ZEND_STRL(name), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC)
#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), getThis(), ZEND_STRL(name), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC)
#define PHP_AMQP_READ_THIS_PROP(name) zend_read_property(this_ce, getThis(), ZEND_STRL(name), 0 PHP5to7_READ_PROP_RV_PARAM_CC TSRMLS_CC)
#define PHP_AMQP_READ_THIS_PROP_BOOL(name) Z_BVAL_P(PHP_AMQP_READ_THIS_PROP(name))
#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))
#if PHP_MAJOR_VERSION >= 7
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)
#else
#define PHP_AMQP_GET_CONNECTION(obj) (amqp_connection_object *)zend_object_store_get_object((obj) TSRMLS_CC)
#define PHP_AMQP_GET_CHANNEL(obj) (amqp_channel_object *)zend_object_store_get_object((obj) TSRMLS_CC)
#define PHP_AMQP_FETCH_CONNECTION(obj) (amqp_connection_object*)(obj)
#define PHP_AMQP_FETCH_CHANNEL(obj) (amqp_channel_object*)(obj)
#endif
#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 TSRMLS_CC); \
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 TSRMLS_CC); \
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) TSRMLS_CC) \
)
#define PHP_AMQP_MAYBE_ERROR_RECOVERABLE(res, channel_resource) (\
(AMQP_RESPONSE_NORMAL != (res).reply_type) \
&& \
PHP_AMQP_RESOURCE_RESPONSE_OK != php_amqp_error_advanced(res, &PHP_AMQP_G(error_message), (channel_resource)->connection_resource, (channel_resource), 0 TSRMLS_CC) \
)
#define PHP_AMQP_IS_ERROR_RECOVERABLE(res, channel_resource, channel_object) ( \
AMQP_RESPONSE_LIBRARY_EXCEPTION == (res).reply_type && AMQP_STATUS_UNEXPECTED_STATE == (res).library_error \
&& (0 <= php_amqp_connection_resource_error_advanced(res, &PHP_AMQP_G(error_message), (channel_resource)->connection_resource, (amqp_channel_t)(channel_resource ? (channel_resource)->channel_id : 0), (channel_object) TSRMLS_CC)) \
)
#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)
#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;
PHP5to7_param_long_type_t error_code;
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
#ifndef PHP_AMQP_VERSION
-#define PHP_AMQP_VERSION "1.9.1"
+#define PHP_AMQP_VERSION "1.9.3"
#endif
#ifndef PHP_AMQP_REVISION
#define PHP_AMQP_REVISION "release"
#endif
int php_amqp_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource TSRMLS_DC);
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 TSRMLS_DC);
/**
* @deprecated
*/
void php_amqp_zend_throw_exception(amqp_rpc_reply_t reply, zend_class_entry *exception_ce, const char *message, PHP5to7_param_long_type_t code TSRMLS_DC);
void php_amqp_zend_throw_exception_short(amqp_rpc_reply_t reply, zend_class_entry *exception_ce TSRMLS_DC);
void php_amqp_maybe_release_buffers_on_channel(amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource);
#endif /* PHP_AMQP_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/amqp-1.9.1/stubs/AMQP.php b/amqp-1.9.3/stubs/AMQP.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQP.php
rename to amqp-1.9.3/stubs/AMQP.php
diff --git a/amqp-1.9.1/stubs/AMQPBasicProperties.php b/amqp-1.9.3/stubs/AMQPBasicProperties.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPBasicProperties.php
rename to amqp-1.9.3/stubs/AMQPBasicProperties.php
diff --git a/amqp-1.9.1/stubs/AMQPChannel.php b/amqp-1.9.3/stubs/AMQPChannel.php
similarity index 97%
rename from amqp-1.9.1/stubs/AMQPChannel.php
rename to amqp-1.9.3/stubs/AMQPChannel.php
index 534e36e..a31c837 100644
--- a/amqp-1.9.1/stubs/AMQPChannel.php
+++ b/amqp-1.9.3/stubs/AMQPChannel.php
@@ -1,258 +1,267 @@
<?php
/**
* stub class representing AMQPChannel from pecl-amqp
*/
class AMQPChannel
{
/**
* 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.
*
* @return bool TRUE on success or FALSE on failure.
*/
public function commitTransaction()
{
}
/**
* Create an instance of an AMQPChannel object.
*
* @param AMQPConnection $amqp_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 $amqp_connection)
{
}
/**
* Check the channel connection.
*
* @return bool Indicates whether the channel is connected.
*/
public function isConnected()
{
}
/**
* Closes the channel.
*/
public function close()
{
}
/**
* Return internal channel ID
*
* @return integer
*/
public function getChannelId()
{
}
/**
* 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.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return bool TRUE on success or FALSE on failure.
*/
public function qos($size, $count)
{
}
/**
* 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.
*
* @return bool TRUE on success or FALSE on failure.
*/
public function rollbackTransaction()
{
}
/**
* Set the number of messages to prefetch from the broker.
*
* Set the number of messages to prefetch from the broker during a call to
* AMQPQueue::consume() or AMQPQueue::get(). Any call to this method will
* automatically set the prefetch window size to 0, meaning that the
* prefetch window size setting will be ignored.
*
* @param integer $count The number of messages to prefetch.
*
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setPrefetchCount($count)
{
}
/**
* Get the number of messages to prefetch from the broker.
*
* @return integer
*/
public function getPrefetchCount()
{
}
/**
* Set the window size to prefetch from the broker.
*
* 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.
*
* @return bool TRUE on success or FALSE on failure.
*/
public function setPrefetchSize($size)
{
}
/**
* Get the window size to prefetch from the broker.
*
* @return integer
*/
public function getPrefetchSize()
{
}
/**
* 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.
*
* @return bool TRUE on success or FALSE on failure.
*/
public function startTransaction()
{
}
/**
* Get the AMQPConnection object in use
*
* @return AMQPConnection
*/
public function getConnection()
{
}
/**
* Redeliver unacknowledged messages.
*
* @param bool $requeue
*/
public function basicRecover($requeue = true)
{
}
/**
* Set the channel to use publisher acknowledgements. This can only used on a non-transactional channel.
*/
public function confirmSelect()
{
}
/**
* Set callback to process basic.ack and basic.nac AMQP server methods (applicable when channel in confirm mode).
*
* @param callable|null $ack_callback
* @param callable|null $nack_callback
*
* 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.
*
* 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 $ack_callback=null, callable $nack_callback=null)
{
}
/**
* 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.
*/
public function waitForConfirm($timeout = 0.0)
{
}
/**
* Set callback to process basic.return AMQP server method
*
* @param callable|null $return_callback
*
* 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.
*
*/
public function setReturnCallback(callable $return_callback=null)
{
}
/**
* Start wait loop for basic.return AMQP server methods
*
* @param float $timeout Timeout in seconds. May be fractional.
*/
public function waitForBasicReturn($timeout = 0.0)
{
}
+
+ /**
+ * Return array of current consumers where key is consumer and value is AMQPQueue consumer is running on
+ *
+ * @return AMQPQueue[]
+ */
+ public function getConsumers()
+ {
+ }
}
diff --git a/amqp-1.9.1/stubs/AMQPChannelException.php b/amqp-1.9.3/stubs/AMQPChannelException.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPChannelException.php
rename to amqp-1.9.3/stubs/AMQPChannelException.php
diff --git a/amqp-1.9.1/stubs/AMQPConnection.php b/amqp-1.9.3/stubs/AMQPConnection.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPConnection.php
rename to amqp-1.9.3/stubs/AMQPConnection.php
diff --git a/amqp-1.9.1/stubs/AMQPConnectionException.php b/amqp-1.9.3/stubs/AMQPConnectionException.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPConnectionException.php
rename to amqp-1.9.3/stubs/AMQPConnectionException.php
diff --git a/amqp-1.9.1/stubs/AMQPDecimal.php b/amqp-1.9.3/stubs/AMQPDecimal.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPDecimal.php
rename to amqp-1.9.3/stubs/AMQPDecimal.php
diff --git a/amqp-1.9.1/stubs/AMQPEnvelope.php b/amqp-1.9.3/stubs/AMQPEnvelope.php
similarity index 91%
rename from amqp-1.9.1/stubs/AMQPEnvelope.php
rename to amqp-1.9.3/stubs/AMQPEnvelope.php
index 07d1241..b61eb81 100644
--- a/amqp-1.9.1/stubs/AMQPEnvelope.php
+++ b/amqp-1.9.3/stubs/AMQPEnvelope.php
@@ -1,84 +1,93 @@
<?php
/**
* stub class representing AMQPEnvelope from pecl-amqp
*/
class AMQPEnvelope extends AMQPBasicProperties
{
public function __construct()
{
}
/**
* Get the body of the message.
*
* @return string The contents of the message body.
*/
public function getBody()
{
}
/**
* Get the routing key of the message.
*
* @return string The message routing key.
*/
public function getRoutingKey()
{
}
+ /**
+ * Get the consumer tag of the message.
+ *
+ * @return string The consumer tag of the message.
+ */
+ public function getConsumerTag()
+ {
+ }
+
/**
* Get the delivery tag of the message.
*
* @return string The delivery tag of the message.
*/
public function getDeliveryTag()
{
}
/**
* Get the exchange name on which the message was published.
*
* @return string The exchange name on which the message was published.
*/
public function getExchangeName()
{
}
/**
* 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()
{
}
/**
* Get a specific message header.
*
* @param string $header_key Name of the header to get the value from.
*
* @return string|boolean The contents of the specified header or FALSE
* if not set.
*/
public function getHeader($header_key)
{
}
/**
* Check whether specific message header exists.
*
* @param string $header_key Name of the header to check.
*
* @return boolean
*/
public function hasHeader($header_key)
{
}
}
diff --git a/amqp-1.9.3/stubs/AMQPEnvelopeException.php b/amqp-1.9.3/stubs/AMQPEnvelopeException.php
new file mode 100644
index 0000000..4e39c96
--- /dev/null
+++ b/amqp-1.9.3/stubs/AMQPEnvelopeException.php
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * stub class representing AMQPEnvelopeException from pecl-amqp
+ */
+class AMQPEnvelopeException extends AMQPException
+{
+ /**
+ * @var AMQPEnvelope
+ */
+ public $envelope;
+}
diff --git a/amqp-1.9.1/stubs/AMQPException.php b/amqp-1.9.3/stubs/AMQPException.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPException.php
rename to amqp-1.9.3/stubs/AMQPException.php
diff --git a/amqp-1.9.1/stubs/AMQPExchange.php b/amqp-1.9.3/stubs/AMQPExchange.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPExchange.php
rename to amqp-1.9.3/stubs/AMQPExchange.php
diff --git a/amqp-1.9.1/stubs/AMQPExchangeException.php b/amqp-1.9.3/stubs/AMQPExchangeException.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPExchangeException.php
rename to amqp-1.9.3/stubs/AMQPExchangeException.php
diff --git a/amqp-1.9.1/stubs/AMQPQueue.php b/amqp-1.9.3/stubs/AMQPQueue.php
similarity index 99%
rename from amqp-1.9.1/stubs/AMQPQueue.php
rename to amqp-1.9.3/stubs/AMQPQueue.php
index 95d7135..05d7f98 100644
--- a/amqp-1.9.1/stubs/AMQPQueue.php
+++ b/amqp-1.9.3/stubs/AMQPQueue.php
@@ -1,386 +1,387 @@
<?php
/**
* stub class representing AMQPQueue from pecl-amqp
*/
class AMQPQueue
{
/**
* 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 string $delivery_tag The message delivery tag of which to
* acknowledge receipt.
* @param integer $flags The only valid flag that can be passed is
* AMQP_MULTIPLE.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean
*/
public function ack($delivery_tag, $flags = AMQP_NOPARAM)
{
}
/**
* Bind the given queue to a routing key on an exchange.
*
* @param string $exchange_name Name of the exchange to bind to.
* @param string $routing_key Pattern or routing key to bind with.
* @param array $arguments Additional binding arguments.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean
*/
public function bind($exchange_name, $routing_key = null, array $arguments = array())
{
}
/**
* Cancel a queue that is already bound to an exchange and routing key.
*
* @param string $consumer_tag The consumer tag cancel. If no tag provided,
* or it is empty string, the latest consumer
* tag on this queue will be used and after
* successful request it will set to null.
* If it also empty, no `basic.cancel`
* request will be sent. When consumer_tag give
* and it equals to latest consumer_tag on queue,
* it will be interpreted as latest consumer_tag usage.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return bool;
*/
public function cancel($consumer_tag = '')
{
}
/**
* Create an instance of an AMQPQueue object.
*
* @param AMQPChannel $amqp_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 $amqp_channel)
{
}
/**
* 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 $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.
*
* @return void
*/
public function consume(
callable $callback = null,
$flags = AMQP_NOPARAM,
$consumerTag = null
) {
}
/**
* 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.
*
* @return integer the message count.
*/
public function declareQueue()
{
}
/**
* 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($flags = AMQP_NOPARAM)
{
}
/**
* 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
* 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.
*
* @return AMQPEnvelope|boolean
*/
public function get($flags = AMQP_NOPARAM)
{
}
/**
* Get the argument associated with the given key.
*
* @param string $key The key to look up.
*
* @return string|integer|boolean The string or integer value associated
* with the given key, or false if the key
* is not set.
*/
public function getArgument($key)
{
}
/**
* Get all set arguments as an array of key/value pairs.
*
* @return array An array containing all of the set key/value pairs.
*/
public function getArguments()
{
}
/**
* 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()
{
}
/**
* Get the configured name.
*
* @return string The configured name as a string.
*/
public function getName()
{
}
/**
* 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 string $delivery_tag 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 AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean
*/
public function nack($delivery_tag, $flags = AMQP_NOPARAM)
{
}
/**
* 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 string $delivery_tag Delivery tag of the message to reject.
* @param integer $flags AMQP_REQUEUE to requeue the message(s).
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean
*/
public function reject($delivery_tag, $flags = AMQP_NOPARAM)
{
}
/**
* Purge the contents of a queue.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean
*/
public function purge()
{
}
/**
* Set a queue argument.
*
* @param string $key The key to set.
* @param mixed $value The value to set.
*
* @return boolean
*/
public function setArgument($key, $value)
{
}
/**
* Set all arguments on the given queue.
*
* All other argument settings will be wiped.
*
* @param array $arguments An array of key/value pairs of arguments.
*
* @return boolean
*/
public function setArguments(array $arguments)
{
}
/**
* Check whether a queue has specific argument.
*
* @param string $key The key to check.
*
* @return boolean
*/
public function hasArgument($key)
{
}
/**
* Set the flags on the queue.
*
* @param integer $flags A bitmask of flags:
* AMQP_DURABLE, AMQP_PASSIVE,
* AMQP_EXCLUSIVE, AMQP_AUTODELETE.
*
* @return boolean
*/
public function setFlags($flags)
{
}
/**
* Set the queue name.
*
* @param string $queue_name The name of the queue.
*
* @return boolean
*/
public function setName($queue_name)
{
}
/**
* Remove a routing key binding on an exchange from the given queue.
*
* @param string $exchange_name The name of the exchange on which the
* queue is bound.
* @param string $routing_key The binding routing key used by the
* queue.
* @param array $arguments Additional binding arguments.
*
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean
*/
public function unbind($exchange_name, $routing_key = null, array $arguments = array())
{
}
/**
* Get the AMQPChannel object in use
*
* @return AMQPChannel
*/
public function getChannel()
{
}
/**
* Get the AMQPConnection object in use
*
* @return AMQPConnection
*/
public function getConnection()
{
}
/**
* Get latest consumer tag. If no consumer available or the latest on was canceled null will be returned.
*
* @return string | null
*/
public function getConsumerTag()
{
}
}
diff --git a/amqp-1.9.1/stubs/AMQPQueueException.php b/amqp-1.9.3/stubs/AMQPQueueException.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPQueueException.php
rename to amqp-1.9.3/stubs/AMQPQueueException.php
diff --git a/amqp-1.9.1/stubs/AMQPTimestamp.php b/amqp-1.9.3/stubs/AMQPTimestamp.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPTimestamp.php
rename to amqp-1.9.3/stubs/AMQPTimestamp.php
diff --git a/amqp-1.9.1/stubs/AMQPValueException.php b/amqp-1.9.3/stubs/AMQPValueException.php
similarity index 100%
rename from amqp-1.9.1/stubs/AMQPValueException.php
rename to amqp-1.9.3/stubs/AMQPValueException.php
diff --git a/amqp-1.9.3/tests/003-channel-consumers.phpt b/amqp-1.9.3/tests/003-channel-consumers.phpt
new file mode 100644
index 0000000..361d0cd
--- /dev/null
+++ b/amqp-1.9.3/tests/003-channel-consumers.phpt
@@ -0,0 +1,82 @@
+--TEST--
+AMQPChannel - consumers
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) {
+ print "skip";
+} ?>
+--FILE--
+<?php
+$connection = new AMQPConnection();
+$connection->connect();
+
+$channel1 = new AMQPChannel($connection);
+
+$q1 = new AMQPQueue($channel1);
+$q1->setName('q1-' . microtime(true));
+$q1->declareQueue();
+
+
+$channel2 = new AMQPChannel($connection);
+
+$q2_0 = new AMQPQueue($channel2);
+$q2_0->setName('q2.0-' . microtime(true));
+$q2_0->declareQueue();
+
+$q2_1 = new AMQPQueue($channel2);
+$q2_1->setName('q2.1-' . microtime(true));
+$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-%f
+c2:
+ test-consumer-2-0: q2.0-%f
+ test-consumer-2-1: q2.1-%f
+
+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-1.9.3/tests/004-queue-consume-nested.phpt b/amqp-1.9.3/tests/004-queue-consume-nested.phpt
new file mode 100644
index 0000000..6c1947e
--- /dev/null
+++ b/amqp-1.9.3/tests/004-queue-consume-nested.phpt
@@ -0,0 +1,107 @@
+--TEST--
+AMQPQueue - nested consumers
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) {
+ print "skip";
+} ?>
+--FILE--
+<?php
+
+function test(AMQPChannel $channel1)
+{
+ $ex1 = new AMQPExchange($channel1);
+ $ex1->setName('ex1-' . microtime(true));
+ $ex1->setType(AMQP_EX_TYPE_FANOUT);
+ $ex1->declareExchange();
+
+ $q1 = new AMQPQueue($channel1);
+ $q1->setName('q1-' . microtime(true));
+ $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-' . microtime(true));
+ $ex2->setType(AMQP_EX_TYPE_FANOUT);
+ $ex2->declareExchange();
+
+ $q2 = new AMQPQueue($channel2);
+ $q2->setName('q2-' . microtime(true));
+ $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;
+ });
+}
+
+$connection1 = new AMQPConnection();
+$connection1->connect();
+$channel1 = new AMQPChannel($connection1);
+echo 'With default prefetch = 3', PHP_EOL;
+test($channel1);
+
+$channel1->close();
+$channel1 = null;
+$connection1->disconnect();
+$connection1 = null;
+
+// var_dump($channel1);
+$connection2 = new AMQPConnection();
+$connection2->connect();
+
+$channel2 = new AMQPChannel($connection2);
+$channel2->setPrefetchCount(1);
+echo 'With prefetch = 1', PHP_EOL;
+test($channel2);
+
+
+
+?>
+--EXPECTF--
+With default prefetch = 3
+1: ex1-%f [message 1 - 0] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+2: ex1-%f [message 1 - 1] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+2: ex1-%f [message 1 - 2] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+2: ex1-%f [message 1 - 3] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+1: ex2-%f [message 2 - 0] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+2: ex2-%f [message 2 - 1] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+1: ex2-%f [message 2 - 2] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+2: ex2-%f [message 2 - 3] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+With prefetch = 1
+1: ex1-%f [message 1 - 0] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+2: ex1-%f [message 1 - 1] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+2: ex2-%f [message 2 - 0] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+2: ex2-%f [message 2 - 1] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+1: ex2-%f [message 2 - 2] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+2: ex1-%f [message 1 - 2] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
+1: ex2-%f [message 2 - 3] amq.ctag-%s - amq.ctag-%s (q2-%f): valid queue
+2: ex1-%f [message 1 - 3] amq.ctag-%s - amq.ctag-%s (q1-%f): valid queue
diff --git a/amqp-1.9.3/tests/004-queue-consume-orphaned.phpt b/amqp-1.9.3/tests/004-queue-consume-orphaned.phpt
new file mode 100644
index 0000000..a9d4286
--- /dev/null
+++ b/amqp-1.9.3/tests/004-queue-consume-orphaned.phpt
@@ -0,0 +1,99 @@
+--TEST--
+AMQPQueue - orphaned envelope
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) {
+ print "skip";
+} ?>
+--FILE--
+<?php
+$connection = new AMQPConnection();
+$connection->connect();
+
+$channel1 = new AMQPChannel($connection);
+
+$ex1 = new AMQPExchange($channel1);
+$ex1->setName('ex1-' . microtime(true));
+$ex1->setType(AMQP_EX_TYPE_FANOUT);
+$ex1->declareExchange();
+
+$q1 = new AMQPQueue($channel1);
+$q1->setName('q1-' . microtime(true));
+$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-' . microtime(true));
+$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->envelope);
+}
+
+?>
+--EXPECTF--
+AMQPEnvelopeException: Orphaned envelope:
+
+object(AMQPEnvelope)#6 (20) {
+ ["content_type":"AMQPBasicProperties":private]=>
+ string(10) "text/plain"
+ ["content_encoding":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["headers":"AMQPBasicProperties":private]=>
+ array(0) {
+ }
+ ["delivery_mode":"AMQPBasicProperties":private]=>
+ int(1)
+ ["priority":"AMQPBasicProperties":private]=>
+ int(0)
+ ["correlation_id":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["reply_to":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["expiration":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["message_id":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["timestamp":"AMQPBasicProperties":private]=>
+ int(0)
+ ["type":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["user_id":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["app_id":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["cluster_id":"AMQPBasicProperties":private]=>
+ string(0) ""
+ ["body":"AMQPEnvelope":private]=>
+ string(13) "test orphaned"
+ ["consumer_tag":"AMQPEnvelope":private]=>
+ string(31) "amq.ctag-%s"
+ ["delivery_tag":"AMQPEnvelope":private]=>
+ int(2)
+ ["is_redelivery":"AMQPEnvelope":private]=>
+ bool(false)
+ ["exchange_name":"AMQPEnvelope":private]=>
+ string(%d) "ex1-%f"
+ ["routing_key":"AMQPEnvelope":private]=>
+ string(0) ""
+}
diff --git a/amqp-1.9.1/tests/_test_helpers.php.inc b/amqp-1.9.3/tests/_test_helpers.php.inc
similarity index 95%
rename from amqp-1.9.1/tests/_test_helpers.php.inc
rename to amqp-1.9.3/tests/_test_helpers.php.inc
index 0d7145e..25c29d0 100644
--- a/amqp-1.9.1/tests/_test_helpers.php.inc
+++ b/amqp-1.9.3/tests/_test_helpers.php.inc
@@ -1,69 +1,71 @@
<?php
function dump_methods($obj) {
$methods = get_class_methods($obj);
echo get_class($obj), PHP_EOL;
foreach($methods as $m) {
if ($m[0] == '_') {
// ignore all _* methods
continue;
}
echo ' ', $m, '():', PHP_EOL, ' ', ' ';
var_dump($obj->$m());
}
}
function dump_message($msg) {
if (!$msg) {
var_dump($msg);
return false;
}
echo get_class($msg), PHP_EOL;
echo " getBody:", PHP_EOL, " ";
var_dump($msg->getBody());
echo " getContentType:", PHP_EOL, " ";
var_dump($msg->getContentType());
echo " getRoutingKey:", PHP_EOL, " ";
var_dump($msg->getRoutingKey());
+ echo " getConsumerTag:", PHP_EOL, " ";
+ var_dump($msg->getConsumerTag());
echo " getDeliveryTag:", PHP_EOL, " ";
var_dump($msg->getDeliveryTag());
echo " getDeliveryMode:", PHP_EOL, " ";
var_dump($msg->getDeliveryMode());
echo " getExchangeName:", PHP_EOL, " ";
var_dump($msg->getExchangeName());
echo " isRedelivery:", PHP_EOL, " ";
var_dump($msg->isRedelivery());
echo " getContentEncoding:", PHP_EOL, " ";
var_dump($msg->getContentEncoding());
echo " getType:", PHP_EOL, " ";
var_dump($msg->getType());
echo " getTimeStamp:", PHP_EOL, " ";
var_dump($msg->getTimeStamp());
echo " getPriority:", PHP_EOL, " ";
var_dump($msg->getPriority());
echo " getExpiration:", PHP_EOL, " ";
var_dump($msg->getExpiration());
echo " getUserId:", PHP_EOL, " ";
var_dump($msg->getUserId());
echo " getAppId:", PHP_EOL, " ";
var_dump($msg->getAppId());
echo " getMessageId:", PHP_EOL, " ";
var_dump($msg->getMessageId());
echo " getReplyTo:", PHP_EOL, " ";
var_dump($msg->getReplyTo());
echo " getCorrelationId:", PHP_EOL, " ";
var_dump($msg->getCorrelationId());
echo " getHeaders:", PHP_EOL, " ";
var_dump($msg->getHeaders());
return false;
}
function consumeThings($message, $queue) {
var_dump($message);
return false;
}
diff --git a/amqp-1.9.1/tests/amqpbasicproperties.phpt b/amqp-1.9.3/tests/amqpbasicproperties.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpbasicproperties.phpt
rename to amqp-1.9.3/tests/amqpbasicproperties.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_basicRecover.phpt b/amqp-1.9.3/tests/amqpchannel_basicRecover.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_basicRecover.phpt
rename to amqp-1.9.3/tests/amqpchannel_basicRecover.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_close.phpt b/amqp-1.9.3/tests/amqpchannel_close.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_close.phpt
rename to amqp-1.9.3/tests/amqpchannel_close.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_confirmSelect.phpt b/amqp-1.9.3/tests/amqpchannel_confirmSelect.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_confirmSelect.phpt
rename to amqp-1.9.3/tests/amqpchannel_confirmSelect.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_construct_basic.phpt b/amqp-1.9.3/tests/amqpchannel_construct_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_construct_basic.phpt
rename to amqp-1.9.3/tests/amqpchannel_construct_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_getChannelId.phpt b/amqp-1.9.3/tests/amqpchannel_getChannelId.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_getChannelId.phpt
rename to amqp-1.9.3/tests/amqpchannel_getChannelId.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_get_connection.phpt b/amqp-1.9.3/tests/amqpchannel_get_connection.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_get_connection.phpt
rename to amqp-1.9.3/tests/amqpchannel_get_connection.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_multi_channel_connection.phpt b/amqp-1.9.3/tests/amqpchannel_multi_channel_connection.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_multi_channel_connection.phpt
rename to amqp-1.9.3/tests/amqpchannel_multi_channel_connection.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_slots_usage.phpt b/amqp-1.9.3/tests/amqpchannel_slots_usage.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpchannel_slots_usage.phpt
rename to amqp-1.9.3/tests/amqpchannel_slots_usage.phpt
diff --git a/amqp-1.9.1/tests/amqpchannel_var_dump.phpt b/amqp-1.9.3/tests/amqpchannel_var_dump.phpt
similarity index 93%
rename from amqp-1.9.1/tests/amqpchannel_var_dump.phpt
rename to amqp-1.9.3/tests/amqpchannel_var_dump.phpt
index 3e606a5..b6fd14f 100644
--- a/amqp-1.9.1/tests/amqpchannel_var_dump.phpt
+++ b/amqp-1.9.3/tests/amqpchannel_var_dump.phpt
@@ -1,98 +1,104 @@
--TEST--
AMQPChannel var_dump
--SKIPIF--
<?php
if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
print "skip";
}
?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
var_dump($ch);
$cnn->disconnect();
var_dump($ch);
?>
--EXPECT--
-object(AMQPChannel)#2 (3) {
+object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
-object(AMQPChannel)#2 (3) {
+object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
diff --git a/amqp-1.9.1/tests/amqpconnection_connect_login_failure.phpt b/amqp-1.9.3/tests/amqpconnection_connect_login_failure.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_connect_login_failure.phpt
rename to amqp-1.9.3/tests/amqpconnection_connect_login_failure.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_connection_getters.phpt b/amqp-1.9.3/tests/amqpconnection_connection_getters.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_connection_getters.phpt
rename to amqp-1.9.3/tests/amqpconnection_connection_getters.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_basic.phpt b/amqp-1.9.3/tests/amqpconnection_construct_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_basic.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_ini_read_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_ini_read_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_ini_read_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_ini_read_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_ini_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_ini_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_ini_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_ini_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_ini_timeout_default.phpt b/amqp-1.9.3/tests/amqpconnection_construct_ini_timeout_default.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_ini_timeout_default.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_ini_timeout_default.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_with_connect_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_with_connect_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_with_connect_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_with_connect_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_with_limits.phpt b/amqp-1.9.3/tests/amqpconnection_construct_with_limits.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_with_limits.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_with_limits.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_with_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_with_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_with_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_with_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_construct_with_write_timeout.phpt b/amqp-1.9.3/tests/amqpconnection_construct_with_write_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_construct_with_write_timeout.phpt
rename to amqp-1.9.3/tests/amqpconnection_construct_with_write_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_getUsedChannels.phpt b/amqp-1.9.3/tests/amqpconnection_getUsedChannels.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_getUsedChannels.phpt
rename to amqp-1.9.3/tests/amqpconnection_getUsedChannels.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_heartbeat.phpt b/amqp-1.9.3/tests/amqpconnection_heartbeat.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_heartbeat.phpt
rename to amqp-1.9.3/tests/amqpconnection_heartbeat.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_heartbeat_with_consumer.phpt b/amqp-1.9.3/tests/amqpconnection_heartbeat_with_consumer.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_heartbeat_with_consumer.phpt
rename to amqp-1.9.3/tests/amqpconnection_heartbeat_with_consumer.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_heartbeat_with_persistent.phpt b/amqp-1.9.3/tests/amqpconnection_heartbeat_with_persistent.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_heartbeat_with_persistent.phpt
rename to amqp-1.9.3/tests/amqpconnection_heartbeat_with_persistent.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_persistent_construct_basic.phpt b/amqp-1.9.3/tests/amqpconnection_persistent_construct_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_persistent_construct_basic.phpt
rename to amqp-1.9.3/tests/amqpconnection_persistent_construct_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_persistent_in_use.phpt b/amqp-1.9.3/tests/amqpconnection_persistent_in_use.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_persistent_in_use.phpt
rename to amqp-1.9.3/tests/amqpconnection_persistent_in_use.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_persistent_reusable.phpt b/amqp-1.9.3/tests/amqpconnection_persistent_reusable.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_persistent_reusable.phpt
rename to amqp-1.9.3/tests/amqpconnection_persistent_reusable.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setHost.phpt b/amqp-1.9.3/tests/amqpconnection_setHost.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setHost.phpt
rename to amqp-1.9.3/tests/amqpconnection_setHost.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setLogin.phpt b/amqp-1.9.3/tests/amqpconnection_setLogin.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setLogin.phpt
rename to amqp-1.9.3/tests/amqpconnection_setLogin.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setPassword.phpt b/amqp-1.9.3/tests/amqpconnection_setPassword.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setPassword.phpt
rename to amqp-1.9.3/tests/amqpconnection_setPassword.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setPort_int.phpt b/amqp-1.9.3/tests/amqpconnection_setPort_int.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setPort_int.phpt
rename to amqp-1.9.3/tests/amqpconnection_setPort_int.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setPort_out_of_range.phpt b/amqp-1.9.3/tests/amqpconnection_setPort_out_of_range.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setPort_out_of_range.phpt
rename to amqp-1.9.3/tests/amqpconnection_setPort_out_of_range.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setPort_string.phpt b/amqp-1.9.3/tests/amqpconnection_setPort_string.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setPort_string.phpt
rename to amqp-1.9.3/tests/amqpconnection_setPort_string.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setReadTimeout_float.phpt b/amqp-1.9.3/tests/amqpconnection_setReadTimeout_float.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setReadTimeout_float.phpt
rename to amqp-1.9.3/tests/amqpconnection_setReadTimeout_float.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setReadTimeout_int.phpt b/amqp-1.9.3/tests/amqpconnection_setReadTimeout_int.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setReadTimeout_int.phpt
rename to amqp-1.9.3/tests/amqpconnection_setReadTimeout_int.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setReadTimeout_out_of_range.phpt b/amqp-1.9.3/tests/amqpconnection_setReadTimeout_out_of_range.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setReadTimeout_out_of_range.phpt
rename to amqp-1.9.3/tests/amqpconnection_setReadTimeout_out_of_range.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setReadTimeout_string.phpt b/amqp-1.9.3/tests/amqpconnection_setReadTimeout_string.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setReadTimeout_string.phpt
rename to amqp-1.9.3/tests/amqpconnection_setReadTimeout_string.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setTimeout_deprecated.phpt b/amqp-1.9.3/tests/amqpconnection_setTimeout_deprecated.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setTimeout_deprecated.phpt
rename to amqp-1.9.3/tests/amqpconnection_setTimeout_deprecated.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setTimeout_float.phpt b/amqp-1.9.3/tests/amqpconnection_setTimeout_float.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setTimeout_float.phpt
rename to amqp-1.9.3/tests/amqpconnection_setTimeout_float.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setTimeout_int.phpt b/amqp-1.9.3/tests/amqpconnection_setTimeout_int.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setTimeout_int.phpt
rename to amqp-1.9.3/tests/amqpconnection_setTimeout_int.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setTimeout_out_of_range.phpt b/amqp-1.9.3/tests/amqpconnection_setTimeout_out_of_range.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setTimeout_out_of_range.phpt
rename to amqp-1.9.3/tests/amqpconnection_setTimeout_out_of_range.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setTimeout_string.phpt b/amqp-1.9.3/tests/amqpconnection_setTimeout_string.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setTimeout_string.phpt
rename to amqp-1.9.3/tests/amqpconnection_setTimeout_string.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setVhost.phpt b/amqp-1.9.3/tests/amqpconnection_setVhost.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setVhost.phpt
rename to amqp-1.9.3/tests/amqpconnection_setVhost.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setWriteTimeout_float.phpt b/amqp-1.9.3/tests/amqpconnection_setWriteTimeout_float.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setWriteTimeout_float.phpt
rename to amqp-1.9.3/tests/amqpconnection_setWriteTimeout_float.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setWriteTimeout_int.phpt b/amqp-1.9.3/tests/amqpconnection_setWriteTimeout_int.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setWriteTimeout_int.phpt
rename to amqp-1.9.3/tests/amqpconnection_setWriteTimeout_int.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setWriteTimeout_out_of_range.phpt b/amqp-1.9.3/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
rename to amqp-1.9.3/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_setWriteTimeout_string.phpt b/amqp-1.9.3/tests/amqpconnection_setWriteTimeout_string.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_setWriteTimeout_string.phpt
rename to amqp-1.9.3/tests/amqpconnection_setWriteTimeout_string.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_ssl.phpt b/amqp-1.9.3/tests/amqpconnection_ssl.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_ssl.phpt
rename to amqp-1.9.3/tests/amqpconnection_ssl.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_toomanychannels.phpt b/amqp-1.9.3/tests/amqpconnection_toomanychannels.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_toomanychannels.phpt
rename to amqp-1.9.3/tests/amqpconnection_toomanychannels.phpt
diff --git a/amqp-1.9.1/tests/amqpconnection_var_dump.phpt b/amqp-1.9.3/tests/amqpconnection_var_dump.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpconnection_var_dump.phpt
rename to amqp-1.9.3/tests/amqpconnection_var_dump.phpt
diff --git a/amqp-1.9.1/tests/amqpdecimal.phpt b/amqp-1.9.3/tests/amqpdecimal.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpdecimal.phpt
rename to amqp-1.9.3/tests/amqpdecimal.phpt
diff --git a/amqp-1.9.1/tests/amqpenvelope_construct.phpt b/amqp-1.9.3/tests/amqpenvelope_construct.phpt
similarity index 94%
rename from amqp-1.9.1/tests/amqpenvelope_construct.phpt
rename to amqp-1.9.3/tests/amqpenvelope_construct.phpt
index d6743fd..6c634d8 100644
--- a/amqp-1.9.1/tests/amqpenvelope_construct.phpt
+++ b/amqp-1.9.3/tests/amqpenvelope_construct.phpt
@@ -1,53 +1,55 @@
--TEST--
AMQPEnvelope construct
--SKIPIF--
<?php
if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
print "skip";
}
--FILE--
<?php
var_dump(new AMQPEnvelope());
?>
--EXPECT--
-object(AMQPEnvelope)#1 (19) {
+object(AMQPEnvelope)#1 (20) {
["content_type":"AMQPBasicProperties":private]=>
string(0) ""
["content_encoding":"AMQPBasicProperties":private]=>
string(0) ""
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["delivery_mode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlation_id":"AMQPBasicProperties":private]=>
string(0) ""
["reply_to":"AMQPBasicProperties":private]=>
string(0) ""
["expiration":"AMQPBasicProperties":private]=>
string(0) ""
["message_id":"AMQPBasicProperties":private]=>
string(0) ""
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
string(0) ""
["user_id":"AMQPBasicProperties":private]=>
string(0) ""
["app_id":"AMQPBasicProperties":private]=>
string(0) ""
["cluster_id":"AMQPBasicProperties":private]=>
string(0) ""
["body":"AMQPEnvelope":private]=>
NULL
+ ["consumer_tag":"AMQPEnvelope":private]=>
+ NULL
["delivery_tag":"AMQPEnvelope":private]=>
NULL
["is_redelivery":"AMQPEnvelope":private]=>
NULL
["exchange_name":"AMQPEnvelope":private]=>
NULL
["routing_key":"AMQPEnvelope":private]=>
NULL
}
diff --git a/amqp-1.9.1/tests/amqpenvelope_get_accessors.phpt b/amqp-1.9.3/tests/amqpenvelope_get_accessors.phpt
similarity index 95%
rename from amqp-1.9.1/tests/amqpenvelope_get_accessors.phpt
rename to amqp-1.9.3/tests/amqpenvelope_get_accessors.phpt
index 995da4d..af93cf8 100644
--- a/amqp-1.9.1/tests/amqpenvelope_get_accessors.phpt
+++ b/amqp-1.9.3/tests/amqpenvelope_get_accessors.phpt
@@ -1,123 +1,127 @@
--TEST--
AMQPEnvelope test get*() accessors
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-'.microtime(true));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . microtime(true));
$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', AMQP_NOPARAM, array('headers' => array('foo' => 'bar')));
// Read from the queue
$msg = $q->get();
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 (19) {
+object(AMQPEnvelope)#5 (20) {
["content_type":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["content_encoding":"AMQPBasicProperties":private]=>
string(0) ""
["headers":"AMQPBasicProperties":private]=>
array(1) {
["foo"]=>
string(3) "bar"
}
["delivery_mode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlation_id":"AMQPBasicProperties":private]=>
string(0) ""
["reply_to":"AMQPBasicProperties":private]=>
string(0) ""
["expiration":"AMQPBasicProperties":private]=>
string(0) ""
["message_id":"AMQPBasicProperties":private]=>
string(0) ""
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
string(0) ""
["user_id":"AMQPBasicProperties":private]=>
string(0) ""
["app_id":"AMQPBasicProperties":private]=>
string(0) ""
["cluster_id":"AMQPBasicProperties":private]=>
string(0) ""
["body":"AMQPEnvelope":private]=>
string(7) "message"
+ ["consumer_tag":"AMQPEnvelope":private]=>
+ string(0) ""
["delivery_tag":"AMQPEnvelope":private]=>
int(1)
["is_redelivery":"AMQPEnvelope":private]=>
bool(false)
["exchange_name":"AMQPEnvelope":private]=>
string(%d) "exchange-%f"
["routing_key":"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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(0) ""
getType:
string(0) ""
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
string(0) ""
getUserId:
string(0) ""
getAppId:
string(0) ""
getMessageId:
string(0) ""
getReplyTo:
string(0) ""
getCorrelationId:
string(0) ""
getHeaders:
array(1) {
["foo"]=>
string(3) "bar"
}
string(3) "bar"
string(3) "bar"
diff --git a/amqp-1.9.1/tests/amqpenvelope_var_dump.phpt b/amqp-1.9.3/tests/amqpenvelope_var_dump.phpt
similarity index 93%
rename from amqp-1.9.1/tests/amqpenvelope_var_dump.phpt
rename to amqp-1.9.3/tests/amqpenvelope_var_dump.phpt
index 2fcaade..ff1723f 100644
--- a/amqp-1.9.1/tests/amqpenvelope_var_dump.phpt
+++ b/amqp-1.9.3/tests/amqpenvelope_var_dump.phpt
@@ -1,118 +1,122 @@
--TEST--
AMQPEnvelope var_dump
--SKIPIF--
<?php
if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
print "skip";
}
--FILE--
<?php
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$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' . microtime(true));
$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");
?>
---EXPECT--
-object(AMQPEnvelope)#5 (19) {
+--EXPECTF--
+object(AMQPEnvelope)#5 (20) {
["content_type":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["content_encoding":"AMQPBasicProperties":private]=>
string(0) ""
["headers":"AMQPBasicProperties":private]=>
array(0) {
}
["delivery_mode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlation_id":"AMQPBasicProperties":private]=>
string(0) ""
["reply_to":"AMQPBasicProperties":private]=>
string(0) ""
["expiration":"AMQPBasicProperties":private]=>
string(0) ""
["message_id":"AMQPBasicProperties":private]=>
string(0) ""
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
string(0) ""
["user_id":"AMQPBasicProperties":private]=>
string(0) ""
["app_id":"AMQPBasicProperties":private]=>
string(0) ""
["cluster_id":"AMQPBasicProperties":private]=>
string(0) ""
["body":"AMQPEnvelope":private]=>
string(7) "message"
+ ["consumer_tag":"AMQPEnvelope":private]=>
+ string(31) "amq.ctag-%s"
["delivery_tag":"AMQPEnvelope":private]=>
int(1)
["is_redelivery":"AMQPEnvelope":private]=>
bool(false)
["exchange_name":"AMQPEnvelope":private]=>
string(9) "exchange1"
["routing_key":"AMQPEnvelope":private]=>
string(9) "routing.1"
}
-object(AMQPEnvelope)#5 (19) {
+object(AMQPEnvelope)#5 (20) {
["content_type":"AMQPBasicProperties":private]=>
string(10) "text/plain"
["content_encoding":"AMQPBasicProperties":private]=>
string(0) ""
["headers":"AMQPBasicProperties":private]=>
array(1) {
["test"]=>
string(6) "passed"
}
["delivery_mode":"AMQPBasicProperties":private]=>
int(1)
["priority":"AMQPBasicProperties":private]=>
int(0)
["correlation_id":"AMQPBasicProperties":private]=>
string(0) ""
["reply_to":"AMQPBasicProperties":private]=>
string(0) ""
["expiration":"AMQPBasicProperties":private]=>
string(0) ""
["message_id":"AMQPBasicProperties":private]=>
string(0) ""
["timestamp":"AMQPBasicProperties":private]=>
int(0)
["type":"AMQPBasicProperties":private]=>
string(0) ""
["user_id":"AMQPBasicProperties":private]=>
string(0) ""
["app_id":"AMQPBasicProperties":private]=>
string(0) ""
["cluster_id":"AMQPBasicProperties":private]=>
string(0) ""
["body":"AMQPEnvelope":private]=>
string(7) "message"
+ ["consumer_tag":"AMQPEnvelope":private]=>
+ string(31) "amq.ctag-%s"
["delivery_tag":"AMQPEnvelope":private]=>
int(2)
["is_redelivery":"AMQPEnvelope":private]=>
bool(false)
["exchange_name":"AMQPEnvelope":private]=>
string(9) "exchange1"
["routing_key":"AMQPEnvelope":private]=>
string(9) "routing.1"
}
diff --git a/amqp-1.9.1/tests/amqpexchange-declare-segfault.phpt b/amqp-1.9.3/tests/amqpexchange-declare-segfault.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange-declare-segfault.phpt
rename to amqp-1.9.3/tests/amqpexchange-declare-segfault.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_attributes.phpt b/amqp-1.9.3/tests/amqpexchange_attributes.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_attributes.phpt
rename to amqp-1.9.3/tests/amqpexchange_attributes.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_bind.phpt b/amqp-1.9.3/tests/amqpexchange_bind.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_bind.phpt
rename to amqp-1.9.3/tests/amqpexchange_bind.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_bind_with_arguments.phpt b/amqp-1.9.3/tests/amqpexchange_bind_with_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_bind_with_arguments.phpt
rename to amqp-1.9.3/tests/amqpexchange_bind_with_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_bind_without_key.phpt b/amqp-1.9.3/tests/amqpexchange_bind_without_key.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_bind_without_key.phpt
rename to amqp-1.9.3/tests/amqpexchange_bind_without_key.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_bind_without_key_with_arguments.phpt b/amqp-1.9.3/tests/amqpexchange_bind_without_key_with_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_bind_without_key_with_arguments.phpt
rename to amqp-1.9.3/tests/amqpexchange_bind_without_key_with_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_channel_refcount.phpt b/amqp-1.9.3/tests/amqpexchange_channel_refcount.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_channel_refcount.phpt
rename to amqp-1.9.3/tests/amqpexchange_channel_refcount.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_construct_basic.phpt b/amqp-1.9.3/tests/amqpexchange_construct_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_construct_basic.phpt
rename to amqp-1.9.3/tests/amqpexchange_construct_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_declare_basic.phpt b/amqp-1.9.3/tests/amqpexchange_declare_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_declare_basic.phpt
rename to amqp-1.9.3/tests/amqpexchange_declare_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_declare_existent.phpt b/amqp-1.9.3/tests/amqpexchange_declare_existent.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_declare_existent.phpt
rename to amqp-1.9.3/tests/amqpexchange_declare_existent.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_declare_with_stalled_reference.phpt b/amqp-1.9.3/tests/amqpexchange_declare_with_stalled_reference.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_declare_with_stalled_reference.phpt
rename to amqp-1.9.3/tests/amqpexchange_declare_with_stalled_reference.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_declare_without_name.phpt b/amqp-1.9.3/tests/amqpexchange_declare_without_name.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_declare_without_name.phpt
rename to amqp-1.9.3/tests/amqpexchange_declare_without_name.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_declare_without_type.phpt b/amqp-1.9.3/tests/amqpexchange_declare_without_type.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_declare_without_type.phpt
rename to amqp-1.9.3/tests/amqpexchange_declare_without_type.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_delete_default_exchange.phpt b/amqp-1.9.3/tests/amqpexchange_delete_default_exchange.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_delete_default_exchange.phpt
rename to amqp-1.9.3/tests/amqpexchange_delete_default_exchange.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_get_channel.phpt b/amqp-1.9.3/tests/amqpexchange_get_channel.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_get_channel.phpt
rename to amqp-1.9.3/tests/amqpexchange_get_channel.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_get_connection.phpt b/amqp-1.9.3/tests/amqpexchange_get_connection.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_get_connection.phpt
rename to amqp-1.9.3/tests/amqpexchange_get_connection.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_invalid_type.phpt b/amqp-1.9.3/tests/amqpexchange_invalid_type.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_invalid_type.phpt
rename to amqp-1.9.3/tests/amqpexchange_invalid_type.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_basic.phpt b/amqp-1.9.3/tests/amqpexchange_publish_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_basic.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_confirms.phpt b/amqp-1.9.3/tests/amqpexchange_publish_confirms.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_confirms.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_confirms.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_confirms_consume.phpt b/amqp-1.9.3/tests/amqpexchange_publish_confirms_consume.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_confirms_consume.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_confirms_consume.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_empty_routing_key.phpt b/amqp-1.9.3/tests/amqpexchange_publish_empty_routing_key.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_empty_routing_key.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_empty_routing_key.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_mandatory.phpt b/amqp-1.9.3/tests/amqpexchange_publish_mandatory.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_mandatory.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_mandatory.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_mandatory_consume.phpt b/amqp-1.9.3/tests/amqpexchange_publish_mandatory_consume.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_mandatory_consume.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_mandatory_consume.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_mandatory_multiple_channels_pitfal.phpt b/amqp-1.9.3/tests/amqpexchange_publish_mandatory_multiple_channels_pitfal.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_mandatory_multiple_channels_pitfal.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_mandatory_multiple_channels_pitfal.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_timeout.disabled b/amqp-1.9.3/tests/amqpexchange_publish_timeout.disabled
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_timeout.disabled
rename to amqp-1.9.3/tests/amqpexchange_publish_timeout.disabled
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_decimal_header.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_decimal_header.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_decimal_header.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_decimal_header.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_null.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_null.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_null.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_null.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_properties.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_properties.phpt
similarity index 98%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_properties.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_properties.phpt
index 9b4025e..19d1a96 100644
--- a/amqp-1.9.1/tests/amqpexchange_publish_with_properties.phpt
+++ b/amqp-1.9.3/tests/amqpexchange_publish_with_properties.phpt
@@ -1,112 +1,114 @@
--TEST--
AMQPExchange publish with properties
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . microtime(true));
$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
);
echo $ex->publish('message', 'routing.key', AMQP_NOPARAM, $attrs) ? 'true' : 'false', PHP_EOL;
//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--
true
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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(1) "2"
getType:
string(1) "7"
getTimeStamp:
int(123)
getPriority:
int(2)
getExpiration:
string(9) "100000000"
getUserId:
string(0) ""
getAppId:
string(1) "5"
getMessageId:
string(1) "3"
getReplyTo:
string(1) "8"
getCorrelationId:
string(1) "9"
getHeaders:
array(0) {
-}
\ No newline at end of file
+}
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_properties_nested_header.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_properties_nested_header.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_properties_nested_header.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_properties_nested_header.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_properties_user_id_failure.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_with_timestamp_header.phpt b/amqp-1.9.3/tests/amqpexchange_publish_with_timestamp_header.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_with_timestamp_header.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_with_timestamp_header.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_publish_xdeath.phpt b/amqp-1.9.3/tests/amqpexchange_publish_xdeath.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_publish_xdeath.phpt
rename to amqp-1.9.3/tests/amqpexchange_publish_xdeath.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_setArgument.phpt b/amqp-1.9.3/tests/amqpexchange_setArgument.phpt
similarity index 97%
rename from amqp-1.9.1/tests/amqpexchange_setArgument.phpt
rename to amqp-1.9.3/tests/amqpexchange_setArgument.phpt
index 87f2ea9..e24b37b 100644
--- a/amqp-1.9.1/tests/amqpexchange_setArgument.phpt
+++ b/amqp-1.9.3/tests/amqpexchange_setArgument.phpt
@@ -1,332 +1,341 @@
--TEST--
AMQPExchange::setArgument() test
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$credentials = array();
$cnn = new AMQPConnection($credentials);
$cnn->connect();
$ch = new AMQPChannel($cnn);
$heartbeat = 10;
$e_name_ae = 'test.exchange.ae.' . microtime(true);
$e_name = 'test.exchange.' . microtime(true);
$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->declareExchange();
var_dump($ex);
$ex->setArgument('x-alternate-exchange-one-more-time', null); // remov key
var_dump($ex);
?>
--EXPECTF--
object(AMQPExchange)#3 (9) {
["connection":"AMQPExchange":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPExchange":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPExchange":private]=>
string(%d) "test.exchange.ae.%f"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["auto_delete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(0) {
}
}
object(AMQPExchange)#4 (9) {
["connection":"AMQPExchange":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPExchange":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPExchange":private]=>
string(%d) "test.exchange.%f"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["auto_delete":"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.%f"
["x-empty-string"]=>
string(0) ""
["x-alternate-exchange-one-more-time"]=>
string(%d) "test.exchange.ae.%f"
["x-numeric-argument"]=>
int(100000)
}
}
object(AMQPExchange)#4 (9) {
["connection":"AMQPExchange":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPExchange":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPExchange":private]=>
string(%d) "test.exchange.%f"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["auto_delete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(4) {
["x-ha-policy"]=>
string(3) "all"
["alternate-exchange"]=>
string(%d) "test.exchange.ae.%f"
["x-empty-string"]=>
string(0) ""
["x-numeric-argument"]=>
int(100000)
}
}
diff --git a/amqp-1.9.1/tests/amqpexchange_set_flag.phpt b/amqp-1.9.3/tests/amqpexchange_set_flag.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_set_flag.phpt
rename to amqp-1.9.3/tests/amqpexchange_set_flag.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_set_flags.phpt b/amqp-1.9.3/tests/amqpexchange_set_flags.phpt
similarity index 97%
rename from amqp-1.9.1/tests/amqpexchange_set_flags.phpt
rename to amqp-1.9.3/tests/amqpexchange_set_flags.phpt
index 5610b38..88f33aa 100644
--- a/amqp-1.9.1/tests/amqpexchange_set_flags.phpt
+++ b/amqp-1.9.3/tests/amqpexchange_set_flags.phpt
@@ -1,114 +1,117 @@
--TEST--
AMQPExchange setFlags()
--SKIPIF--
<?php
if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
print "skip";
}
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . microtime(true));
$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]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPExchange":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPExchange":private]=>
string(%d) "exchange-%f"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(true)
["durable":"AMQPExchange":private]=>
bool(true)
["auto_delete":"AMQPExchange":private]=>
bool(true)
["internal":"AMQPExchange":private]=>
bool(true)
["arguments":"AMQPExchange":private]=>
array(1) {
["x-ha-policy"]=>
string(3) "all"
}
}
diff --git a/amqp-1.9.1/tests/amqpexchange_unbind.phpt b/amqp-1.9.3/tests/amqpexchange_unbind.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_unbind.phpt
rename to amqp-1.9.3/tests/amqpexchange_unbind.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_unbind_with_arguments.phpt b/amqp-1.9.3/tests/amqpexchange_unbind_with_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_unbind_with_arguments.phpt
rename to amqp-1.9.3/tests/amqpexchange_unbind_with_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_unbind_without_key.phpt b/amqp-1.9.3/tests/amqpexchange_unbind_without_key.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_unbind_without_key.phpt
rename to amqp-1.9.3/tests/amqpexchange_unbind_without_key.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_unbind_without_key_with_arguments.phpt b/amqp-1.9.3/tests/amqpexchange_unbind_without_key_with_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpexchange_unbind_without_key_with_arguments.phpt
rename to amqp-1.9.3/tests/amqpexchange_unbind_without_key_with_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpexchange_var_dump.phpt b/amqp-1.9.3/tests/amqpexchange_var_dump.phpt
similarity index 96%
rename from amqp-1.9.1/tests/amqpexchange_var_dump.phpt
rename to amqp-1.9.3/tests/amqpexchange_var_dump.phpt
index c603ffa..242999b 100644
--- a/amqp-1.9.1/tests/amqpexchange_var_dump.phpt
+++ b/amqp-1.9.3/tests/amqpexchange_var_dump.phpt
@@ -1,203 +1,209 @@
--TEST--
AMQPExchange var_dump
--SKIPIF--
<?php
if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
print "skip";
}
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . microtime(true));
$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]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPExchange":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPExchange":private]=>
string(%d) "exchange-%f"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["auto_delete":"AMQPExchange":private]=>
bool(false)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(0) {
}
}
object(AMQPExchange)#3 (9) {
["connection":"AMQPExchange":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPExchange":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPExchange":private]=>
string(%d) "exchange-%f"
["type":"AMQPExchange":private]=>
string(6) "fanout"
["passive":"AMQPExchange":private]=>
bool(false)
["durable":"AMQPExchange":private]=>
bool(false)
["auto_delete":"AMQPExchange":private]=>
bool(false)
["internal":"AMQPExchange":private]=>
bool(false)
["arguments":"AMQPExchange":private]=>
array(1) {
["x-ha-policy"]=>
string(3) "all"
}
}
diff --git a/amqp-1.9.1/tests/amqpqueue_attributes.phpt b/amqp-1.9.3/tests/amqpqueue_attributes.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_attributes.phpt
rename to amqp-1.9.3/tests/amqpqueue_attributes.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_bind_basic.phpt b/amqp-1.9.3/tests/amqpqueue_bind_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_bind_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_bind_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_bind_basic_empty_routing_key.phpt b/amqp-1.9.3/tests/amqpqueue_bind_basic_empty_routing_key.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_bind_basic_empty_routing_key.phpt
rename to amqp-1.9.3/tests/amqpqueue_bind_basic_empty_routing_key.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_bind_basic_headers_arguments.phpt b/amqp-1.9.3/tests/amqpqueue_bind_basic_headers_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_bind_basic_headers_arguments.phpt
rename to amqp-1.9.3/tests/amqpqueue_bind_basic_headers_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_cancel.phpt b/amqp-1.9.3/tests/amqpqueue_cancel.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_cancel.phpt
rename to amqp-1.9.3/tests/amqpqueue_cancel.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_construct_basic.phpt b/amqp-1.9.3/tests/amqpqueue_construct_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_construct_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_construct_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_consume_basic.phpt b/amqp-1.9.3/tests/amqpqueue_consume_basic.phpt
similarity index 96%
rename from amqp-1.9.1/tests/amqpqueue_consume_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_consume_basic.phpt
index 046db51..f06891b 100644
--- a/amqp-1.9.1/tests/amqpqueue_consume_basic.phpt
+++ b/amqp-1.9.3/tests/amqpqueue_consume_basic.phpt
@@ -1,139 +1,143 @@
--TEST--
AMQPQueue::consume basic
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . microtime(true));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . microtime(true));
$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_DURABLE));
$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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(0) ""
getType:
string(0) ""
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
string(0) ""
getUserId:
string(0) ""
getAppId:
string(0) ""
getMessageId:
string(0) ""
getReplyTo:
string(0) ""
getCorrelationId:
string(0) ""
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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(0) ""
getType:
string(0) ""
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
string(0) ""
getUserId:
string(0) ""
getAppId:
string(0) ""
getMessageId:
string(0) ""
getReplyTo:
string(0) ""
getCorrelationId:
string(0) ""
getHeaders:
array(0) {
-}
\ No newline at end of file
+}
diff --git a/amqp-1.9.1/tests/amqpqueue_consume_multiple.phpt b/amqp-1.9.3/tests/amqpqueue_consume_multiple.phpt
similarity index 60%
rename from amqp-1.9.1/tests/amqpqueue_consume_multiple.phpt
rename to amqp-1.9.3/tests/amqpqueue_consume_multiple.phpt
index 7ba4ada..e398281 100644
--- a/amqp-1.9.1/tests/amqpqueue_consume_multiple.phpt
+++ b/amqp-1.9.3/tests/amqpqueue_consume_multiple.phpt
@@ -1,71 +1,81 @@
--TEST--
AMQPQueue::consume multiple
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$time = microtime(true);
$cnn = new AMQPConnection();
$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-' . $time);
$ex->setType(AMQP_EX_TYPE_TOPIC);
$ex->declareExchange();
// Create and bind queues
$q1 = new AMQPQueue($ch);
$q1->setName('queue-one-' . $time);
$q1->declareQueue();
$q1->bind($ex->getName(), 'routing.one');
-$q2 = new AMQPQueue($ch);
+$q2 = new AMQPQueue($ch2);
$q2->setName('queue-two-' . $time);
$q2->declareQueue();
$q2->bind($ex->getName(), 'routing.two');
-$q3 = new AMQPQueue($ch);
+$q3 = new AMQPQueue($ch3);
$q3->setName('queue-three-' . $time);
$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->getBody() . "-" . $message->getRoutingKey() . "\n";
+ 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();
?>
---EXPECT--
-message1-routing.one
-message2-routing.two
+--EXPECTF--
+Message: message1, routing key: routing.one, consumer tag: amq.ctag-%s
+Queue: queue-one-%f, 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-%f, consumer tag: amq.ctag-%s
+Queue and message consumer tag matches
diff --git a/amqp-1.9.1/tests/amqpqueue_consume_multiple_no_doubles.phpt b/amqp-1.9.3/tests/amqpqueue_consume_multiple_no_doubles.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_consume_multiple_no_doubles.phpt
rename to amqp-1.9.3/tests/amqpqueue_consume_multiple_no_doubles.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_consume_nonexistent.phpt b/amqp-1.9.3/tests/amqpqueue_consume_nonexistent.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_consume_nonexistent.phpt
rename to amqp-1.9.3/tests/amqpqueue_consume_nonexistent.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_consume_timeout.phpt b/amqp-1.9.3/tests/amqpqueue_consume_timeout.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_consume_timeout.phpt
rename to amqp-1.9.3/tests/amqpqueue_consume_timeout.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_declare_basic.phpt b/amqp-1.9.3/tests/amqpqueue_declare_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_declare_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_declare_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_declare_with_arguments.phpt b/amqp-1.9.3/tests/amqpqueue_declare_with_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_declare_with_arguments.phpt
rename to amqp-1.9.3/tests/amqpqueue_declare_with_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_declare_with_stalled_reference.phpt b/amqp-1.9.3/tests/amqpqueue_declare_with_stalled_reference.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_declare_with_stalled_reference.phpt
rename to amqp-1.9.3/tests/amqpqueue_declare_with_stalled_reference.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_delete_basic.phpt b/amqp-1.9.3/tests/amqpqueue_delete_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_delete_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_delete_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_empty_name.phpt b/amqp-1.9.3/tests/amqpqueue_empty_name.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_empty_name.phpt
rename to amqp-1.9.3/tests/amqpqueue_empty_name.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_get_basic.phpt b/amqp-1.9.3/tests/amqpqueue_get_basic.phpt
similarity index 96%
rename from amqp-1.9.1/tests/amqpqueue_get_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_get_basic.phpt
index 3a2f48e..759e896 100644
--- a/amqp-1.9.1/tests/amqpqueue_get_basic.phpt
+++ b/amqp-1.9.3/tests/amqpqueue_get_basic.phpt
@@ -1,165 +1,171 @@
--TEST--
AMQPQueue::get basic
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
require '_test_helpers.php.inc';
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('exchange-'. microtime(true));
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . microtime(true));
$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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(0) ""
getType:
string(0) ""
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
string(0) ""
getUserId:
string(0) ""
getAppId:
string(0) ""
getMessageId:
string(0) ""
getReplyTo:
string(0) ""
getCorrelationId:
string(0) ""
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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(0) ""
getType:
string(0) ""
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
string(0) ""
getUserId:
string(0) ""
getAppId:
string(0) ""
getMessageId:
string(0) ""
getReplyTo:
string(0) ""
getCorrelationId:
string(0) ""
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-%f"
isRedelivery:
bool(false)
getContentEncoding:
string(0) ""
getType:
string(0) ""
getTimeStamp:
int(0)
getPriority:
int(0)
getExpiration:
string(0) ""
getUserId:
string(0) ""
getAppId:
string(0) ""
getMessageId:
string(0) ""
getReplyTo:
string(0) ""
getCorrelationId:
string(0) ""
getHeaders:
array(0) {
}
call #3
-bool(false)
\ No newline at end of file
+bool(false)
diff --git a/amqp-1.9.1/tests/amqpqueue_get_channel.phpt b/amqp-1.9.3/tests/amqpqueue_get_channel.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_get_channel.phpt
rename to amqp-1.9.3/tests/amqpqueue_get_channel.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_get_connection.phpt b/amqp-1.9.3/tests/amqpqueue_get_connection.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_get_connection.phpt
rename to amqp-1.9.3/tests/amqpqueue_get_connection.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_get_empty_body.phpt b/amqp-1.9.3/tests/amqpqueue_get_empty_body.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_get_empty_body.phpt
rename to amqp-1.9.3/tests/amqpqueue_get_empty_body.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_get_headers.phpt b/amqp-1.9.3/tests/amqpqueue_get_headers.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_get_headers.phpt
rename to amqp-1.9.3/tests/amqpqueue_get_headers.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_get_nonexistent.phpt b/amqp-1.9.3/tests/amqpqueue_get_nonexistent.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_get_nonexistent.phpt
rename to amqp-1.9.3/tests/amqpqueue_get_nonexistent.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_headers_with_bool.phpt b/amqp-1.9.3/tests/amqpqueue_headers_with_bool.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_headers_with_bool.phpt
rename to amqp-1.9.3/tests/amqpqueue_headers_with_bool.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_headers_with_float.phpt b/amqp-1.9.3/tests/amqpqueue_headers_with_float.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_headers_with_float.phpt
rename to amqp-1.9.3/tests/amqpqueue_headers_with_float.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_headers_with_null.phpt b/amqp-1.9.3/tests/amqpqueue_headers_with_null.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_headers_with_null.phpt
rename to amqp-1.9.3/tests/amqpqueue_headers_with_null.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_nack.phpt b/amqp-1.9.3/tests/amqpqueue_nack.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_nack.phpt
rename to amqp-1.9.3/tests/amqpqueue_nack.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_nested_arrays.phpt b/amqp-1.9.3/tests/amqpqueue_nested_arrays.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_nested_arrays.phpt
rename to amqp-1.9.3/tests/amqpqueue_nested_arrays.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_nested_headers.phpt b/amqp-1.9.3/tests/amqpqueue_nested_headers.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_nested_headers.phpt
rename to amqp-1.9.3/tests/amqpqueue_nested_headers.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_purge_basic.phpt b/amqp-1.9.3/tests/amqpqueue_purge_basic.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_purge_basic.phpt
rename to amqp-1.9.3/tests/amqpqueue_purge_basic.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_setArgument.phpt b/amqp-1.9.3/tests/amqpqueue_setArgument.phpt
similarity index 96%
rename from amqp-1.9.1/tests/amqpqueue_setArgument.phpt
rename to amqp-1.9.3/tests/amqpqueue_setArgument.phpt
index 57c2a14..1f3d623 100644
--- a/amqp-1.9.1/tests/amqpqueue_setArgument.phpt
+++ b/amqp-1.9.3/tests/amqpqueue_setArgument.phpt
@@ -1,318 +1,327 @@
--TEST--
AMQPQueue::setArgument() test
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$credentials = array();
$cnn = new AMQPConnection($credentials);
$cnn->connect();
$ch = new AMQPChannel($cnn);
$heartbeat = 10;
$q_dead_name = 'test.queue.dead.' . microtime(true);
$q_name = 'test.queue.' . microtime(true);
$q = new AMQPQueue($ch);
$q->setName($q_name);
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
var_dump($q);
$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->setFlags(AMQP_AUTODELETE);
$q_dead->declareQueue();
var_dump($q_dead);
$q_dead->setArgument('x-dead-letter-routing-key', null); // removes this key
var_dump($q_dead);
?>
--EXPECTF--
object(AMQPQueue)#3 (9) {
["connection":"AMQPQueue":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPQueue":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPQueue":private]=>
string(%d) "test.queue.%f"
["consumer_tag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["auto_delete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(0) {
}
}
object(AMQPQueue)#4 (9) {
["connection":"AMQPQueue":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPQueue":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPQueue":private]=>
string(%d) "test.queue.dead.%f"
["consumer_tag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["auto_delete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(3) {
["x-dead-letter-exchange"]=>
string(0) ""
["x-dead-letter-routing-key"]=>
string(%d) "test.queue.%f"
["x-message-ttl"]=>
int(100000)
}
}
object(AMQPQueue)#4 (9) {
["connection":"AMQPQueue":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPQueue":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPQueue":private]=>
string(%d) "test.queue.dead.%f"
["consumer_tag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["auto_delete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(2) {
["x-dead-letter-exchange"]=>
string(0) ""
["x-message-ttl"]=>
int(100000)
}
}
diff --git a/amqp-1.9.1/tests/amqpqueue_unbind_basic_empty_routing_key.phpt b/amqp-1.9.3/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
rename to amqp-1.9.3/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_unbind_basic_headers_arguments.phpt b/amqp-1.9.3/tests/amqpqueue_unbind_basic_headers_arguments.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqpqueue_unbind_basic_headers_arguments.phpt
rename to amqp-1.9.3/tests/amqpqueue_unbind_basic_headers_arguments.phpt
diff --git a/amqp-1.9.1/tests/amqpqueue_var_dump.phpt b/amqp-1.9.3/tests/amqpqueue_var_dump.phpt
similarity index 97%
rename from amqp-1.9.1/tests/amqpqueue_var_dump.phpt
rename to amqp-1.9.3/tests/amqpqueue_var_dump.phpt
index 5916850..b8a97d4 100644
--- a/amqp-1.9.1/tests/amqpqueue_var_dump.phpt
+++ b/amqp-1.9.3/tests/amqpqueue_var_dump.phpt
@@ -1,114 +1,117 @@
--TEST--
AMQPQueue var_dump
--SKIPIF--
<?php
if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
print "skip";
}
--FILE--
<?php
$cnn = new AMQPConnection();
$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);
?>
--EXPECT--
object(AMQPQueue)#4 (9) {
["connection":"AMQPQueue":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["channel":"AMQPQueue":private]=>
- object(AMQPChannel)#2 (3) {
+ object(AMQPChannel)#2 (4) {
["connection":"AMQPChannel":private]=>
object(AMQPConnection)#1 (15) {
["login":"AMQPConnection":private]=>
string(5) "guest"
["password":"AMQPConnection":private]=>
string(5) "guest"
["host":"AMQPConnection":private]=>
string(9) "localhost"
["vhost":"AMQPConnection":private]=>
string(1) "/"
["port":"AMQPConnection":private]=>
int(5672)
["read_timeout":"AMQPConnection":private]=>
float(0)
["write_timeout":"AMQPConnection":private]=>
float(0)
["connect_timeout":"AMQPConnection":private]=>
float(0)
["channel_max":"AMQPConnection":private]=>
int(256)
["frame_max":"AMQPConnection":private]=>
int(131072)
["heartbeat":"AMQPConnection":private]=>
int(0)
["cacert":"AMQPConnection":private]=>
string(0) ""
["key":"AMQPConnection":private]=>
string(0) ""
["cert":"AMQPConnection":private]=>
string(0) ""
["verify":"AMQPConnection":private]=>
bool(true)
}
["prefetch_count":"AMQPChannel":private]=>
int(3)
["prefetch_size":"AMQPChannel":private]=>
int(0)
+ ["consumers":"AMQPChannel":private]=>
+ array(0) {
+ }
}
["name":"AMQPQueue":private]=>
string(14) "queue_var_dump"
["consumer_tag":"AMQPQueue":private]=>
NULL
["passive":"AMQPQueue":private]=>
bool(false)
["durable":"AMQPQueue":private]=>
bool(false)
["exclusive":"AMQPQueue":private]=>
bool(false)
["auto_delete":"AMQPQueue":private]=>
bool(true)
["arguments":"AMQPQueue":private]=>
array(0) {
}
}
diff --git a/amqp-1.9.1/tests/amqptimestamp.phpt b/amqp-1.9.3/tests/amqptimestamp.phpt
similarity index 100%
rename from amqp-1.9.1/tests/amqptimestamp.phpt
rename to amqp-1.9.3/tests/amqptimestamp.phpt
diff --git a/amqp-1.9.1/tests/bug_17831.phpt b/amqp-1.9.3/tests/bug_17831.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_17831.phpt
rename to amqp-1.9.3/tests/bug_17831.phpt
diff --git a/amqp-1.9.1/tests/bug_19707.phpt b/amqp-1.9.3/tests/bug_19707.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_19707.phpt
rename to amqp-1.9.3/tests/bug_19707.phpt
diff --git a/amqp-1.9.1/tests/bug_19840.phpt b/amqp-1.9.3/tests/bug_19840.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_19840.phpt
rename to amqp-1.9.3/tests/bug_19840.phpt
diff --git a/amqp-1.9.1/tests/bug_61533.phpt b/amqp-1.9.3/tests/bug_61533.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_61533.phpt
rename to amqp-1.9.3/tests/bug_61533.phpt
diff --git a/amqp-1.9.1/tests/bug_62354.phpt b/amqp-1.9.3/tests/bug_62354.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_62354.phpt
rename to amqp-1.9.3/tests/bug_62354.phpt
diff --git a/amqp-1.9.1/tests/bug_gh147.phpt b/amqp-1.9.3/tests/bug_gh147.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh147.phpt
rename to amqp-1.9.3/tests/bug_gh147.phpt
diff --git a/amqp-1.9.1/tests/bug_gh155_direct_reply_to.phpt b/amqp-1.9.3/tests/bug_gh155_direct_reply_to.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh155_direct_reply_to.phpt
rename to amqp-1.9.3/tests/bug_gh155_direct_reply_to.phpt
diff --git a/amqp-1.9.1/tests/bug_gh50-1.phpt b/amqp-1.9.3/tests/bug_gh50-1.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh50-1.phpt
rename to amqp-1.9.3/tests/bug_gh50-1.phpt
diff --git a/amqp-1.9.1/tests/bug_gh50-2.phpt b/amqp-1.9.3/tests/bug_gh50-2.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh50-2.phpt
rename to amqp-1.9.3/tests/bug_gh50-2.phpt
diff --git a/amqp-1.9.1/tests/bug_gh50-3.phpt b/amqp-1.9.3/tests/bug_gh50-3.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh50-3.phpt
rename to amqp-1.9.3/tests/bug_gh50-3.phpt
diff --git a/amqp-1.9.1/tests/bug_gh50-4.phpt b/amqp-1.9.3/tests/bug_gh50-4.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh50-4.phpt
rename to amqp-1.9.3/tests/bug_gh50-4.phpt
diff --git a/amqp-1.9.1/tests/bug_gh53-2.phpt b/amqp-1.9.3/tests/bug_gh53-2.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh53-2.phpt
rename to amqp-1.9.3/tests/bug_gh53-2.phpt
diff --git a/amqp-1.9.1/tests/bug_gh53.phpt b/amqp-1.9.3/tests/bug_gh53.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh53.phpt
rename to amqp-1.9.3/tests/bug_gh53.phpt
diff --git a/amqp-1.9.1/tests/bug_gh72-1.phpt b/amqp-1.9.3/tests/bug_gh72-1.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh72-1.phpt
rename to amqp-1.9.3/tests/bug_gh72-1.phpt
diff --git a/amqp-1.9.1/tests/bug_gh72-2.phpt b/amqp-1.9.3/tests/bug_gh72-2.phpt
similarity index 100%
rename from amqp-1.9.1/tests/bug_gh72-2.phpt
rename to amqp-1.9.3/tests/bug_gh72-2.phpt
diff --git a/amqp-1.9.1/tests/package-version.phpt b/amqp-1.9.3/tests/package-version.phpt
similarity index 100%
rename from amqp-1.9.1/tests/package-version.phpt
rename to amqp-1.9.3/tests/package-version.phpt
diff --git a/package.xml b/package.xml
index 1835d92..f9af762 100644
--- a/package.xml
+++ b/package.xml
@@ -1,955 +1,977 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.10.1" 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>2017-06-12</date>
- <time>13:16:42</time>
+ <date>2017-10-19</date>
+ <time>13:51:16</time>
<version>
- <release>1.9.1</release>
+ <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>
-* Separate queue and exchange args to prevent segfault with opcache enabled (Bogdan Padalko)
+* 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.0...v1.9.1
+https://github.com/pdezwart/php-amqp/compare/v1.9.1...v1.9.3
</notes>
<contents>
<dir name="/">
<file md5sum="4c1173b46d733544c9d32e6caf73be78" name="config.m4" role="src" />
<file md5sum="d4ad59768110240c333a4c524ab88a81" name="config.w32" role="src" />
<file md5sum="fef7c9a5d92ed9043d5a8f39c9a99fa7" name="benchmark.php" role="doc" />
<file md5sum="c2bc5a8aa3fb7f8d0c924f584e20809d" name="CREDITS" role="doc" />
<file md5sum="b3e70313289e3ea66cae3089b7e571b8" name="LICENSE" role="doc" />
- <file md5sum="852c2f0af17702a1d8bdc86ba1412b1a" name="tests/_test_helpers.php.inc" role="test" />
+ <file md5sum="faaa7130786487ae7bfda8adaeea93c2" name="tests/_test_helpers.php.inc" role="test" />
<file md5sum="ad68e777e537d8610bab90d3fcb8eb50" name="tests/amqpexchange_publish_timeout.disabled" role="test" />
- <file md5sum="73aa240e6d704a2a858c1e268746dc12" name="amqp.c" role="src" />
+ <file md5sum="b0f69b10982e2a58df302b8104e0a607" name="amqp.c" role="src" />
<file md5sum="7babdcf410d57e3da9c4a5b32e2a4a36" name="amqp_basic_properties.c" role="src" />
<file md5sum="c62dc325454cd341dfe7b36b6ba4fccb" name="amqp_basic_properties.h" role="src" />
- <file md5sum="36f1a79ee8b5fa24a8712963d6b6fd49" name="amqp_channel.c" role="src" />
+ <file md5sum="74d4f5700aaca06e14c32537a1469e23" name="amqp_channel.c" role="src" />
<file md5sum="8704617230ce35a136b7f7a57568100f" name="amqp_channel.h" role="src" />
<file md5sum="1451586be3452d805dd9a9585f9943cb" name="amqp_connection.c" role="src" />
<file md5sum="ecd982518fffc49e5e6ceaf9c3136193" name="amqp_connection.h" role="src" />
- <file md5sum="3be1ecbf104aa6c8d1e6233e4e08c4ee" name="amqp_connection_resource.c" role="src" />
+ <file md5sum="f90a0a4ce752755ab798bf9ae90f38c2" name="amqp_connection_resource.c" role="src" />
<file md5sum="6db73a0629dcd05ec8490a01135fe53c" name="amqp_connection_resource.h" role="src" />
<file md5sum="5f6c903b0d9c84fc3cffd7476747d2eb" name="amqp_decimal.c" role="src" />
<file md5sum="072342fa335efef478f07d10e5da3212" name="amqp_decimal.h" role="src" />
- <file md5sum="79d0c425d9a81182038f816ca8f08be8" name="amqp_envelope.c" role="src" />
+ <file md5sum="20d11c4e56d3878e3b94be59bd9e6d35" name="amqp_envelope.c" role="src" />
<file md5sum="64bb5307ac2b4b4cdf3f799d776b4089" name="amqp_envelope.h" role="src" />
<file md5sum="9b88919994838df02d274644695513c2" name="amqp_exchange.c" role="src" />
<file md5sum="f2c00069fd753dba21897dd8c3a0cb03" name="amqp_exchange.h" role="src" />
<file md5sum="dca507c25bd73a54067f43c13bdb750f" name="amqp_methods_handling.c" role="src" />
<file md5sum="5ffc6d80e7e5c3006e71dccc79fef131" name="amqp_methods_handling.h" role="src" />
- <file md5sum="5ee4b0cc1431895ade61688526a0ccf5" name="amqp_queue.c" role="src" />
+ <file md5sum="0b5f47217dd54ab791ea94b88ad420c1" name="amqp_queue.c" role="src" />
<file md5sum="7405fbf5defd24497f1e0a2163b0dffc" name="amqp_queue.h" role="src" />
<file md5sum="470b4e3558aee9eca7c6bfd355bb12c2" name="amqp_timestamp.c" role="src" />
<file md5sum="3117b944bd36604827dbba0e41b718b8" name="amqp_timestamp.h" role="src" />
<file md5sum="171ca95312d330a2bb7b17d8362987da" name="amqp_type.c" role="src" />
<file md5sum="7888a972689144a7b9a11952ffc522a7" name="amqp_type.h" role="src" />
- <file md5sum="ed907eadc0922b52427fdb3b5dbc7c41" name="php5_support.h" role="src" />
- <file md5sum="f5458b8d301f422341339ad5b5c3538f" name="php7_support.h" role="src" />
- <file md5sum="ec481a948c9f30319118514b287b54f2" name="php_amqp.h" role="src" />
+ <file md5sum="efff34069e7da203f93c7ed9865fa6e1" name="php5_support.h" role="src" />
+ <file md5sum="9833597acdb7ea5b4b3307142792c545" name="php7_support.h" role="src" />
+ <file md5sum="2e336d08862f9f93ba12925d5c6af834" name="php_amqp.h" role="src" />
+ <file md5sum="64f3ee6a3fb11c06920520b030a28dc5" name="tests/003-channel-consumers.phpt" role="test" />
+ <file md5sum="ba9ae1b848ebb481c4357bed8a709014" name="tests/004-queue-consume-nested.phpt" role="test" />
+ <file md5sum="be58c4897e42d2df45545c3b5f092bdb" name="tests/004-queue-consume-orphaned.phpt" role="test" />
<file md5sum="fa50fadb23d82d41863cbb92cbaf71f5" name="tests/amqpbasicproperties.phpt" role="test" />
<file md5sum="842b5bbde94da2bb8fbd8282ae72bd71" name="tests/amqpchannel_basicRecover.phpt" role="test" />
<file md5sum="a873d20f9c3814c1f5b5c39571044349" name="tests/amqpchannel_close.phpt" role="test" />
<file md5sum="2a4b8d7fa70e9994056aea6990ee67fb" name="tests/amqpchannel_confirmSelect.phpt" role="test" />
<file md5sum="804eb9007733180f4300197288e7cd30" name="tests/amqpchannel_construct_basic.phpt" role="test" />
<file md5sum="fbb15ebdf594756a61ff250318fbecbc" name="tests/amqpchannel_getChannelId.phpt" role="test" />
<file md5sum="9c9cc955cdfd88e9824613aa90cc07aa" name="tests/amqpchannel_get_connection.phpt" role="test" />
<file md5sum="8df78eedf3254e35401bb04b5f921e45" name="tests/amqpchannel_multi_channel_connection.phpt" role="test" />
<file md5sum="7ed3240775603a7ddbf37e6876e61e45" name="tests/amqpchannel_slots_usage.phpt" role="test" />
- <file md5sum="df0b2dbca95451cd3f7a531fed4b338c" name="tests/amqpchannel_var_dump.phpt" role="test" />
+ <file md5sum="2b6226eaca9789c4b191172fb84c495c" name="tests/amqpchannel_var_dump.phpt" role="test" />
<file md5sum="f6a5540e9da042896e012d907f52dfa7" name="tests/amqpconnection_connect_login_failure.phpt" role="test" />
<file md5sum="ab671ce4cfeefa0f77caca47fc3926b5" name="tests/amqpconnection_connection_getters.phpt" role="test" />
<file md5sum="64c152378d6dea3efd16e59e64cdef55" name="tests/amqpconnection_construct_basic.phpt" role="test" />
<file md5sum="5824298e6564f6e9231d196114d1c77e" name="tests/amqpconnection_construct_ini_read_timeout.phpt" role="test" />
<file md5sum="5e6235fbdbc75cbd99cad1c0617a3269" name="tests/amqpconnection_construct_ini_timeout.phpt" role="test" />
<file md5sum="97e9d595eab5d25db6bcbb050f9c5f19" name="tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt" role="test" />
<file md5sum="cafbd1b8ec295026c37ac67a9e779b3c" name="tests/amqpconnection_construct_ini_timeout_default.phpt" role="test" />
<file md5sum="f851af4db4ff8b90ea80cb9bc395cee5" name="tests/amqpconnection_construct_with_connect_timeout.phpt" role="test" />
<file md5sum="6b120cda108f2f05ab1eff06ef02e92f" name="tests/amqpconnection_construct_with_limits.phpt" role="test" />
<file md5sum="ae036274132482eb5662da360a6af391" name="tests/amqpconnection_construct_with_timeout.phpt" role="test" />
<file md5sum="0b5526b800bc605338584d214e05b5e1" name="tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt" role="test" />
<file md5sum="6e7be2cf0ba67bdbd51b4549d4a05d95" name="tests/amqpconnection_construct_with_write_timeout.phpt" role="test" />
<file md5sum="b23b3ac5c6d68ebd53e7b56f447b699a" name="tests/amqpconnection_getUsedChannels.phpt" role="test" />
<file md5sum="6552721460fb599402ea900878b494e7" name="tests/amqpconnection_heartbeat.phpt" role="test" />
<file md5sum="2aeb742bdfdae2cf9ed41b968d553698" name="tests/amqpconnection_heartbeat_with_consumer.phpt" role="test" />
<file md5sum="3165d8aef946f0a0b540596e905d9156" name="tests/amqpconnection_heartbeat_with_persistent.phpt" role="test" />
<file md5sum="9e7f8576ff71311929ecae5119712906" name="tests/amqpconnection_persistent_construct_basic.phpt" role="test" />
<file md5sum="39287e41d546cdeb329df6e6e3284f3d" name="tests/amqpconnection_persistent_in_use.phpt" role="test" />
<file md5sum="cad266168a54c7b9aeddfe85c6f647b5" name="tests/amqpconnection_persistent_reusable.phpt" role="test" />
<file md5sum="2cb04633b3e25285b16eba11c468091e" name="tests/amqpconnection_setHost.phpt" role="test" />
<file md5sum="2d98d2921087152f05baf03b4c3d38f9" name="tests/amqpconnection_setLogin.phpt" role="test" />
<file md5sum="b947e9a0862c329d77b3c1c359e06d1e" name="tests/amqpconnection_setPassword.phpt" role="test" />
<file md5sum="98c04e50c1f828a1dbac1f5615a29895" name="tests/amqpconnection_setPort_int.phpt" role="test" />
<file md5sum="7c24ac91124bd6bbffd3ef302cfd1721" name="tests/amqpconnection_setPort_out_of_range.phpt" role="test" />
<file md5sum="f3851993f5d2be8bfd6093825c308b8e" name="tests/amqpconnection_setPort_string.phpt" role="test" />
<file md5sum="8223be5940730e6ca06f80d2a7e7460e" name="tests/amqpconnection_setReadTimeout_float.phpt" role="test" />
<file md5sum="8393a7fea7816e107d3e1c56d6511a6b" name="tests/amqpconnection_setReadTimeout_int.phpt" role="test" />
<file md5sum="acc371cda24e1225060e2be3635e96c4" name="tests/amqpconnection_setReadTimeout_out_of_range.phpt" role="test" />
<file md5sum="8f3d1d22f5af666600b19ec4d20e72d2" name="tests/amqpconnection_setReadTimeout_string.phpt" role="test" />
<file md5sum="2887356c3bd4544d08f97f1266e9028d" name="tests/amqpconnection_setTimeout_deprecated.phpt" role="test" />
<file md5sum="fca046c775db1ea3087458a1561c227a" name="tests/amqpconnection_setTimeout_float.phpt" role="test" />
<file md5sum="40dfd77c4c08f8528951d47e42cda7fb" name="tests/amqpconnection_setTimeout_int.phpt" role="test" />
<file md5sum="d0cd2aa004803b2f05ab467edf4f1036" name="tests/amqpconnection_setTimeout_out_of_range.phpt" role="test" />
<file md5sum="28ef38b64e446ac2dfcc748862387ceb" name="tests/amqpconnection_setTimeout_string.phpt" role="test" />
<file md5sum="b045ae9098ff06a00ee7146d8d413a69" name="tests/amqpconnection_setVhost.phpt" role="test" />
<file md5sum="1b5380a431ebf72b2c0b8a5f6e370721" name="tests/amqpconnection_setWriteTimeout_float.phpt" role="test" />
<file md5sum="eb34d68a4069135dac436bf2b3cf2b8f" name="tests/amqpconnection_setWriteTimeout_int.phpt" role="test" />
<file md5sum="1557d33bc6c620c3cb6f64aefec95eb6" name="tests/amqpconnection_setWriteTimeout_out_of_range.phpt" role="test" />
<file md5sum="63efc639ba17621d65facd6a957e4a3e" name="tests/amqpconnection_setWriteTimeout_string.phpt" role="test" />
<file md5sum="bfa2932981b5027fd9ea817af940288d" name="tests/amqpconnection_ssl.phpt" role="test" />
<file md5sum="dac615c869f608dbdc3dbc8587a5ab9a" name="tests/amqpconnection_toomanychannels.phpt" role="test" />
<file md5sum="1c02c8168834e08bf8cf76ebe1516f05" name="tests/amqpconnection_var_dump.phpt" role="test" />
<file md5sum="5536de7c295245e0d3bc2f34a3f38042" name="tests/amqpdecimal.phpt" role="test" />
- <file md5sum="d77b233c13ea9a9a483c6b804094ecc4" name="tests/amqpenvelope_construct.phpt" role="test" />
- <file md5sum="9bc38e573971661f9ced3432b404e34b" name="tests/amqpenvelope_get_accessors.phpt" role="test" />
- <file md5sum="87eff31f7776b4ca580c5e3cc73e4dbb" name="tests/amqpenvelope_var_dump.phpt" role="test" />
+ <file md5sum="7ced91fd8a3642b582b6707a114f2781" name="tests/amqpenvelope_construct.phpt" role="test" />
+ <file md5sum="d8e2c1d3887ea0558beaab8e138d301a" name="tests/amqpenvelope_get_accessors.phpt" role="test" />
+ <file md5sum="e39997d486928b8376ff8e28b780fe19" name="tests/amqpenvelope_var_dump.phpt" role="test" />
<file md5sum="91af58e35f198c72f72ef8cc445382f1" name="tests/amqpexchange-declare-segfault.phpt" role="test" />
<file md5sum="0f6e538a4abb44d9bde6af8fc9481e19" name="tests/amqpexchange_attributes.phpt" role="test" />
<file md5sum="3cdd27b9ac134c99278e13a7783ee0bf" name="tests/amqpexchange_bind.phpt" role="test" />
<file md5sum="a8d465a0ba6d926e77b03a0af44972d8" name="tests/amqpexchange_bind_with_arguments.phpt" role="test" />
<file md5sum="0d1917327d0be2a106107fd40da240c2" name="tests/amqpexchange_bind_without_key.phpt" role="test" />
<file md5sum="14d8f19aaa7ef5dfc6433a69ad1392f7" name="tests/amqpexchange_bind_without_key_with_arguments.phpt" role="test" />
<file md5sum="5c0c19fbe0080234182f77b88f8a3b49" name="tests/amqpexchange_channel_refcount.phpt" role="test" />
<file md5sum="e14bc6d3e6bf2db658522fd880ff8342" name="tests/amqpexchange_construct_basic.phpt" role="test" />
<file md5sum="978a4d0d8bf603990e99d686d6298dcf" name="tests/amqpexchange_declare_basic.phpt" role="test" />
<file md5sum="c115bd162f6f76851a1ef4a6b045dbc1" name="tests/amqpexchange_declare_existent.phpt" role="test" />
<file md5sum="ef9c53add89f1e46d24a6b5041074b2c" name="tests/amqpexchange_declare_with_stalled_reference.phpt" role="test" />
<file md5sum="1c5013b561e7ebcf6e3b2826a0738c45" name="tests/amqpexchange_declare_without_name.phpt" role="test" />
<file md5sum="80850d20bcc03e6d7f02a816aa1c28b5" name="tests/amqpexchange_declare_without_type.phpt" role="test" />
<file md5sum="ac55043263ef12570a12b7c48258d009" name="tests/amqpexchange_delete_default_exchange.phpt" role="test" />
<file md5sum="8e5fb0edb96401eb40b02fa96403231b" name="tests/amqpexchange_get_channel.phpt" role="test" />
<file md5sum="f7576d0cfaba1da1861438f9372cb221" name="tests/amqpexchange_get_connection.phpt" role="test" />
<file md5sum="e068267152373a4c5792f2bf0092027e" name="tests/amqpexchange_invalid_type.phpt" role="test" />
<file md5sum="28d40d0147069b95f19370dabcc05d51" name="tests/amqpexchange_publish_basic.phpt" role="test" />
<file md5sum="78d5848be6331cd5622820acc3904d57" name="tests/amqpexchange_publish_confirms.phpt" role="test" />
<file md5sum="6e38a653405dff922f5e8c33ae0d9c0e" name="tests/amqpexchange_publish_confirms_consume.phpt" role="test" />
<file md5sum="4d07c2070b00e062b8dbeb3ba47e7423" name="tests/amqpexchange_publish_empty_routing_key.phpt" role="test" />
<file md5sum="0b7bf50928f889e3552f255095a41c5a" name="tests/amqpexchange_publish_mandatory.phpt" role="test" />
<file md5sum="dea788cd8c7332f55a6b376803c9d1dc" name="tests/amqpexchange_publish_mandatory_consume.phpt" role="test" />
<file md5sum="da6b0eef46a24f63f24fdade2e9c1545" name="tests/amqpexchange_publish_mandatory_multiple_channels_pitfal.phpt" role="test" />
<file md5sum="17d9f63c34080e1c67c7a61e31a7e77d" name="tests/amqpexchange_publish_with_decimal_header.phpt" role="test" />
<file md5sum="22b69d2bfab58d6d710ee796c04a91fd" name="tests/amqpexchange_publish_with_null.phpt" role="test" />
- <file md5sum="8127175c0c129fd4d6359636f058bc21" name="tests/amqpexchange_publish_with_properties.phpt" role="test" />
+ <file md5sum="84c314cfd6ea0ef9dc009f5824cb127b" name="tests/amqpexchange_publish_with_properties.phpt" role="test" />
<file md5sum="100a493cfe499876c744c6320021f6d5" name="tests/amqpexchange_publish_with_properties_ignore_num_header.phpt" role="test" />
<file md5sum="5b78840065355c5d66fda97ccb3e320a" name="tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt" role="test" />
<file md5sum="fe5c26b2041d25fd4b5895c84c6ceee1" name="tests/amqpexchange_publish_with_properties_nested_header.phpt" role="test" />
<file md5sum="f412c35e04d632d9f1ecf57efb195bfd" name="tests/amqpexchange_publish_with_properties_user_id_failure.phpt" role="test" />
<file md5sum="e85263c667bd3d8a82542955772e97db" name="tests/amqpexchange_publish_with_timestamp_header.phpt" role="test" />
<file md5sum="cc4b29eeaa0cd39dd2565cceff087e58" name="tests/amqpexchange_publish_xdeath.phpt" role="test" />
- <file md5sum="97258b28a1ddd674700e1b88b0550e61" name="tests/amqpexchange_setArgument.phpt" role="test" />
+ <file md5sum="ee44b13b82ac668528aee0a019653591" name="tests/amqpexchange_setArgument.phpt" role="test" />
<file md5sum="6692eef7a0bb10e53ef74e1809e3dd85" name="tests/amqpexchange_set_flag.phpt" role="test" />
- <file md5sum="89a47a36dc64658da5428c435802f0f7" name="tests/amqpexchange_set_flags.phpt" role="test" />
+ <file md5sum="ac0941949e581e4a3d5600bd009114db" name="tests/amqpexchange_set_flags.phpt" role="test" />
<file md5sum="647497c26f3df6a927848a51bb871fc8" name="tests/amqpexchange_unbind.phpt" role="test" />
<file md5sum="f638c9fc507429242b9ddcd775f99abc" name="tests/amqpexchange_unbind_with_arguments.phpt" role="test" />
<file md5sum="db754e7e6d2dba44ab49f92b736e1de4" name="tests/amqpexchange_unbind_without_key.phpt" role="test" />
<file md5sum="497f46c611f6520f68a56f244a594a4b" name="tests/amqpexchange_unbind_without_key_with_arguments.phpt" role="test" />
- <file md5sum="9001b6dbb4d1803d6f5ae14b2020cb1f" name="tests/amqpexchange_var_dump.phpt" role="test" />
+ <file md5sum="9ca02838c11470830e93f954d8dc0c78" name="tests/amqpexchange_var_dump.phpt" role="test" />
<file md5sum="bcfdc6784ec35990525a1cf5db1c4539" name="tests/amqpqueue_attributes.phpt" role="test" />
<file md5sum="4a0a5a690b1f784d85bd040302575a3d" name="tests/amqpqueue_bind_basic.phpt" role="test" />
<file md5sum="da143124281d829386f617269ec93fcf" name="tests/amqpqueue_bind_basic_empty_routing_key.phpt" role="test" />
<file md5sum="de63dbee4f05ec49ce48ec198b843f4b" name="tests/amqpqueue_bind_basic_headers_arguments.phpt" role="test" />
<file md5sum="9b39051f8ef3472bb23b9748da28314d" name="tests/amqpqueue_cancel.phpt" role="test" />
<file md5sum="2fc0d97c30d609f40b7c85f529d3f752" name="tests/amqpqueue_construct_basic.phpt" role="test" />
- <file md5sum="3afae78709d63c465942a12b87e4be7a" name="tests/amqpqueue_consume_basic.phpt" role="test" />
- <file md5sum="e772e975f5b3d44935e6bb7766ad88e1" name="tests/amqpqueue_consume_multiple.phpt" role="test" />
+ <file md5sum="614b245bed2c133c457a171a0d2d8ac2" name="tests/amqpqueue_consume_basic.phpt" role="test" />
+ <file md5sum="3f37c89263cb9207ba8adbfb9333c0ab" name="tests/amqpqueue_consume_multiple.phpt" role="test" />
<file md5sum="5e36e341a8797edeee72397d8adcb7bb" name="tests/amqpqueue_consume_multiple_no_doubles.phpt" role="test" />
<file md5sum="ce3b8a87a7098e28ecd53e315e7f5b71" name="tests/amqpqueue_consume_nonexistent.phpt" role="test" />
<file md5sum="ae666872e458783556c67fe6abdd794f" name="tests/amqpqueue_consume_timeout.phpt" role="test" />
<file md5sum="52fff1bf831ded585e3f8819504204b8" name="tests/amqpqueue_declare_basic.phpt" role="test" />
<file md5sum="443dfd9d12d9a3e204c37938011889a5" name="tests/amqpqueue_declare_with_arguments.phpt" role="test" />
<file md5sum="0cd41fc43328676bc9a2f3148e3d37ae" name="tests/amqpqueue_declare_with_stalled_reference.phpt" role="test" />
<file md5sum="589544992486dc8be9060c3a9ed0c531" name="tests/amqpqueue_delete_basic.phpt" role="test" />
<file md5sum="5f559bb943f89d6d2b7f5ab1a85dc42b" name="tests/amqpqueue_empty_name.phpt" role="test" />
- <file md5sum="0ad1ccd80ce1b4e8ba724b5938d55f8b" name="tests/amqpqueue_get_basic.phpt" role="test" />
+ <file md5sum="cdef0cd7f6143b2d25e2812eb2a6e0cd" name="tests/amqpqueue_get_basic.phpt" role="test" />
<file md5sum="6cce48f3831c2d78e92ef263097386d9" name="tests/amqpqueue_get_channel.phpt" role="test" />
<file md5sum="5d764f35a9635bd532e9af55f6e63f41" name="tests/amqpqueue_get_connection.phpt" role="test" />
<file md5sum="3148d357f550c22bd83ec5339ca63133" name="tests/amqpqueue_get_empty_body.phpt" role="test" />
<file md5sum="512095e9f3e98adc9ffd3a5406920c62" name="tests/amqpqueue_get_headers.phpt" role="test" />
<file md5sum="fc8f622409a0cc39b6ee2bb040e39da8" name="tests/amqpqueue_get_nonexistent.phpt" role="test" />
<file md5sum="e5e91148bef1c93af8428c8315364998" name="tests/amqpqueue_headers_with_bool.phpt" role="test" />
<file md5sum="0148833c3e17e9a206d3006b72654ca7" name="tests/amqpqueue_headers_with_float.phpt" role="test" />
<file md5sum="2c786082311c24bbee0ebc5e75cea843" name="tests/amqpqueue_headers_with_null.phpt" role="test" />
<file md5sum="0f586fa4ee026cef30cf5d330af1133e" name="tests/amqpqueue_nack.phpt" role="test" />
<file md5sum="c61d7596374c94b3adc4fab185d00c80" name="tests/amqpqueue_nested_arrays.phpt" role="test" />
<file md5sum="df42a25a266fd070630d7ad28ba3c06e" name="tests/amqpqueue_nested_headers.phpt" role="test" />
<file md5sum="abaf080a5feab914919e8bcf837e9d83" name="tests/amqpqueue_purge_basic.phpt" role="test" />
- <file md5sum="d4e9e44834e2b4111c093d10b64c6b5c" name="tests/amqpqueue_setArgument.phpt" role="test" />
+ <file md5sum="86c37f318becd35155402affe7659f16" name="tests/amqpqueue_setArgument.phpt" role="test" />
<file md5sum="cc8d6bd67a59536e3a92a3550016e82e" name="tests/amqpqueue_unbind_basic_empty_routing_key.phpt" role="test" />
<file md5sum="49ab1e6c77ed9331b5371c04faf95653" name="tests/amqpqueue_unbind_basic_headers_arguments.phpt" role="test" />
- <file md5sum="096dcbc0c8c9cae96804d2a50efb05c6" name="tests/amqpqueue_var_dump.phpt" role="test" />
+ <file md5sum="6af56197068ad75fa98b32bcdc48e637" name="tests/amqpqueue_var_dump.phpt" role="test" />
<file md5sum="522735b54c65f14c9793c1f979964f81" name="tests/amqptimestamp.phpt" role="test" />
<file md5sum="efbcc35b58c7b65064660ca65fb1f8da" name="tests/bug_17831.phpt" role="test" />
<file md5sum="d85e785d26e265b242b94af5ed2fa046" name="tests/bug_19707.phpt" role="test" />
<file md5sum="189e780725cd8e3f0308446545b48c35" name="tests/bug_19840.phpt" role="test" />
<file md5sum="7d494f04d735f7934831ed515336181f" name="tests/bug_61533.phpt" role="test" />
<file md5sum="70c4b1222072be9591ff0f2d6bd4a0c9" name="tests/bug_62354.phpt" role="test" />
<file md5sum="8dd0f6b63737787108527ae2f77bc6f0" name="tests/bug_gh147.phpt" role="test" />
<file md5sum="6157e371b447ebf125b36340ebbac39c" name="tests/bug_gh155_direct_reply_to.phpt" role="test" />
<file md5sum="764b70058dc0694eb7060c50f9bda611" name="tests/bug_gh50-1.phpt" role="test" />
<file md5sum="61c947c8bcc32226f09c845f1ca69734" name="tests/bug_gh50-2.phpt" role="test" />
<file md5sum="555901187984375d0eda9fd2aa5fb9ed" name="tests/bug_gh50-3.phpt" role="test" />
<file md5sum="c791ab105f32830962f2961745dc433e" name="tests/bug_gh50-4.phpt" role="test" />
<file md5sum="b7c71b6b0c0653eafe9f8caa15335975" name="tests/bug_gh53-2.phpt" role="test" />
<file md5sum="e70de43b7962d958d88e248dbf277e34" name="tests/bug_gh53.phpt" role="test" />
<file md5sum="d8de8918a3c73ebdcb4159581ea58b5f" name="tests/bug_gh72-1.phpt" role="test" />
<file md5sum="4f74239a15b2aae85b498f947d294e3c" name="tests/bug_gh72-2.phpt" role="test" />
<file md5sum="212e44c003f3b950b3f85958fdc5a367" name="tests/package-version.phpt" role="test" />
<file md5sum="3d2f028b7fceb8cf35e56237338af93d" name="stubs/AMQP.php" role="doc" />
<file md5sum="a22f310ae4901dbcdc577b2fcce6d7cd" name="stubs/AMQPBasicProperties.php" role="doc" />
- <file md5sum="df8e110904ab01844454973dd5237d33" name="stubs/AMQPChannel.php" role="doc" />
+ <file md5sum="dcd6a589870731ce551d32dc135b7dbd" name="stubs/AMQPChannel.php" role="doc" />
<file md5sum="d79254277f60751c4ba6697333af5d37" name="stubs/AMQPChannelException.php" role="doc" />
<file md5sum="e239feadbf1d0e2c5dd4fb6c58f3887d" name="stubs/AMQPConnection.php" role="doc" />
<file md5sum="da1cd6ac1b51f2433904ce770e6f4ca3" name="stubs/AMQPConnectionException.php" role="doc" />
<file md5sum="c21e96e7fb7412a6fabf52f62441701a" name="stubs/AMQPDecimal.php" role="doc" />
- <file md5sum="52852f8e246f6ba28f6cb3cceb5389ef" name="stubs/AMQPEnvelope.php" role="doc" />
+ <file md5sum="fd33d84a1eb37f238141068c642a0aec" name="stubs/AMQPEnvelope.php" role="doc" />
+ <file md5sum="477fc70c91bdae22a5375326abc8b5ed" name="stubs/AMQPEnvelopeException.php" role="doc" />
<file md5sum="0b9b43b817a884d311f8f8013d8a5adc" name="stubs/AMQPException.php" role="doc" />
<file md5sum="4ba4a62fd5debb2453390e1a4da7d325" name="stubs/AMQPExchange.php" role="doc" />
<file md5sum="7d1035c7a2b82f9187b10f05fe882eed" name="stubs/AMQPExchangeException.php" role="doc" />
- <file md5sum="f670cc7ecbb99576fa297ce55213d2ec" name="stubs/AMQPQueue.php" role="doc" />
+ <file md5sum="498b4f8e6e8ca26c0b3fdc51d7663d92" name="stubs/AMQPQueue.php" role="doc" />
<file md5sum="d7da0562e86197fc6bb0d12af0a25495" name="stubs/AMQPQueueException.php" role="doc" />
<file md5sum="0d1f0359883d316344c4f8a2a53add0e" name="stubs/AMQPTimestamp.php" role="doc" />
<file md5sum="c9e20d2df7f8b831276bf49e1d33da47" name="stubs/AMQPValueException.php" role="doc" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.3.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>
+ <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.qos
Added persistent connections
Cleaned up codebase
Fixed 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 values
Cleaned up variable usage
Fixed 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 password
Improved consume method to block for MIN messages, and try to get MAX messages if available
Fixed zval descoping bugs
Fixed 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, Sep 12, 10:31 AM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42817
Default Alt Text
(347 KB)

Event Timeline