Page MenuHomePhabricator (Chris)

No OneTemporary

Size
254 KB
Referenced Files
None
Subscribers
None
diff --git a/amqp-1.7.0alpha2/CREDITS b/amqp-1.7.0/CREDITS
similarity index 100%
rename from amqp-1.7.0alpha2/CREDITS
rename to amqp-1.7.0/CREDITS
diff --git a/amqp-1.7.0alpha2/LICENSE b/amqp-1.7.0/LICENSE
similarity index 100%
rename from amqp-1.7.0alpha2/LICENSE
rename to amqp-1.7.0/LICENSE
diff --git a/amqp-1.7.0alpha2/amqp.c b/amqp-1.7.0/amqp.c
similarity index 97%
rename from amqp-1.7.0alpha2/amqp.c
rename to amqp-1.7.0/amqp.c
index 41546b5..1bc135f 100644
--- a/amqp-1.7.0alpha2/amqp.c
+++ b/amqp-1.7.0/amqp.c
@@ -1,500 +1,498 @@
/*
+----------------------------------------------------------------------+
| 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 |
+----------------------------------------------------------------------+
*/
/* $Id: amqp.c 327551 2012-09-09 03:49:34Z pdezwart $ */
#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_channel.h"
#include "amqp_queue.h"
#include "amqp_exchange.h"
#include "amqp_envelope.h"
#include "amqp_connection_resource.h"
#ifdef PHP_WIN32
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
#include "amqp_connection.h"
#include "amqp_connection_resource.h"
#include "amqp_channel.h"
#include "amqp_envelope.h"
#include "amqp_exchange.h"
#include "amqp_queue.h"
/* 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_functions[]
*
*Every user visible function must have an entry in amqp_functions[].
*/
zend_function_entry amqp_functions[] = {
{NULL, NULL, NULL} /* Must be the last line in amqp_functions[] */
};
/* }}} */
/* {{{ amqp_module_entry
*/
zend_module_entry amqp_module_entry = {
STANDARD_MODULE_HEADER,
"amqp",
amqp_functions,
PHP_MINIT(amqp),
PHP_MSHUTDOWN(amqp),
NULL,
NULL,
PHP_MINFO(amqp),
PHP_AMQP_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_AMQP
ZEND_GET_MODULE(amqp)
#endif
void php_amqp_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource TSRMLS_DC)
{
assert(connection_resource != NULL);
switch (php_amqp_connection_resource_error(reply, message, connection_resource, (amqp_channel_t)(channel_resource ? channel_resource->channel_id : 0) TSRMLS_CC)) {
case PHP_AMQP_RESOURCE_RESPONSE_OK:
break;
case PHP_AMQP_RESOURCE_RESPONSE_ERROR:
- /* Library or other non-protocol or even protocol related errors may be here, do nothing with this for now. */
+ /* 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 TSRMLS_CC);
}
- /* No more error handling necessary, returning. */
- break;
- case PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED:
- /* Mark connection as closed to prevent sending any further requests */
- connection_resource->is_connected = '\0';
-
- /* Close connection with all its channels */
- php_amqp_prepare_for_disconnect(connection_resource TSRMLS_CC);
- connection_resource->is_dirty = '\1';
-
/* 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;
}
}
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);
}
}
amqp_bytes_t php_amqp_long_string(char const *cstr, PHP5to7_param_str_len_type_t len)
{
if (len < 1) {
return amqp_empty_bytes;
}
amqp_bytes_t result;
result.len = (size_t)len;
result.bytes = (void *) cstr;
return result;
}
char *stringify_bytes(amqp_bytes_t bytes)
{
/* We will need up to 4 chars per byte, plus the terminating 0 */
char *res = emalloc(bytes.len * 4 + 1);
uint8_t *data = bytes.bytes;
char *p = res;
size_t i;
for (i = 0; i < bytes.len; i++) {
if (data[i] >= 32 && data[i] != 127) {
*p++ = data[i];
} else {
*p++ = '\\';
*p++ = '0' + (data[i] >> 6);
*p++ = '0' + (data[i] >> 3 & 0x7);
*p++ = '0' + (data[i] & 0x7);
}
}
*p = 0;
return res;
}
void internal_convert_zval_to_amqp_table(zval *zvalArguments, amqp_table_t *arguments, char allow_int_keys TSRMLS_DC)
{
HashTable *ht;
HashPosition pos;
zval *value;
zval **data;
PHP5to7_ZEND_REAL_HASH_KEY_T *real_key;
char *key;
uint key_len;
ulong index;
char type[16];
amqp_table_t *inner_table;
ht = Z_ARRVAL_P(zvalArguments);
/* Allocate all the memory necessary for storing the arguments */
arguments->entries = (amqp_table_entry_t *)ecalloc((size_t)zend_hash_num_elements(ht), sizeof(amqp_table_entry_t));
arguments->num_entries = 0;
PHP5to7_ZEND_HASH_FOREACH_KEY_VAL(ht, index, real_key, key, key_len, data, value, pos) {
char *strKey;
char *strValue;
amqp_table_entry_t *table;
amqp_field_value_t *field;
/* Now pull the key */
if (!PHP5to7_ZEND_HASH_KEY_IS_STRING(ht, real_key, key, key_len, index, pos)) {
if (allow_int_keys) {
/* Convert to strings non-string keys */
char str[32];
key_len = sprintf(str, "%lu", index);
key = str;
} else {
/* Skip things that are not strings */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ignoring non-string header field '%lu'", index);
PHP5to7_ZEND_HASH_FOREACH_CONTINUE;
}
} else {
PHP5to7_ZEND_HASH_KEY_MAYBE_UNPACK(real_key, key, key_len);
}
/* Build the value */
table = &arguments->entries[arguments->num_entries++];
field = &table->value;
switch (Z_TYPE_P(value)) {
PHP5to7_CASE_IS_BOOL:
field->kind = AMQP_FIELD_KIND_BOOLEAN;
field->value.boolean = (amqp_boolean_t)Z_LVAL_P(value);
break;
case IS_DOUBLE:
field->kind = AMQP_FIELD_KIND_F64;
field->value.f64 = Z_DVAL_P(value);
break;
case IS_LONG:
field->kind = AMQP_FIELD_KIND_I64;
field->value.i64 = Z_LVAL_P(value);
break;
case IS_STRING:
field->kind = AMQP_FIELD_KIND_UTF8;
if (Z_STRLEN_P(value)) {
amqp_bytes_t bytes;
bytes.len = (size_t) Z_STRLEN_P(value);
bytes.bytes = estrndup(Z_STRVAL_P(value), (uint)Z_STRLEN_P(value));
field->value.bytes = bytes;
} else {
field->value.bytes = amqp_empty_bytes;
}
break;
case IS_ARRAY:
field->kind = AMQP_FIELD_KIND_TABLE;
internal_convert_zval_to_amqp_table(value, &field->value.table, 1 TSRMLS_CC);
break;
default:
switch(Z_TYPE_P(value)) {
case IS_NULL: strcpy(type, "null"); break;
case IS_OBJECT: strcpy(type, "object"); break;
case IS_RESOURCE: strcpy(type, "resource"); break;
default: strcpy(type, "unknown");
}
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Ignoring field '%s' due to unsupported value type (%s)", key, type);
/* Reset entries counter back */
arguments->num_entries --;
PHP5to7_ZEND_HASH_FOREACH_CONTINUE;
}
strKey = estrndup(key, key_len);
table->key = amqp_cstring_bytes(strKey);
} PHP5to7_ZEND_HASH_FOREACH_END();
};
-inline amqp_table_t *convert_zval_to_amqp_table(zval *zvalArguments TSRMLS_DC)
+amqp_table_t *convert_zval_to_amqp_table(zval *zvalArguments TSRMLS_DC)
{
amqp_table_t *arguments;
/* In setArguments, we are overwriting all the existing values */
arguments = (amqp_table_t *)emalloc(sizeof(amqp_table_t));
internal_convert_zval_to_amqp_table(zvalArguments, arguments, 0 TSRMLS_CC);
return arguments;
}
void internal_php_amqp_free_amqp_table(amqp_table_t *object, char clear_root)
{
if (!object) {
return;
}
if (object->entries) {
int macroEntryCounter;
for (macroEntryCounter = 0; macroEntryCounter < object->num_entries; macroEntryCounter++) {
amqp_table_entry_t *entry = &object->entries[macroEntryCounter];
efree(entry->key.bytes);
switch (entry->value.kind) {
case AMQP_FIELD_KIND_TABLE:
internal_php_amqp_free_amqp_table(&entry->value.value.table, 0);
break;
case AMQP_FIELD_KIND_UTF8:
if (entry->value.value.bytes.bytes) {
efree(entry->value.value.bytes.bytes);
}
break;
default:
break;
}
}
efree(object->entries);
}
if (clear_root) {
efree(object);
}
}
void php_amqp_free_amqp_table(amqp_table_t *object)
{
internal_php_amqp_free_amqp_table(object, 1);
}
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_END()
/* {{{ PHP_MINIT_FUNCTION
*/
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_envelope)(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, "AMQPExchangeException", NULL);
amqp_exchange_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;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(amqp)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
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();
}
/* }}} */
/*
*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.7.0alpha2/amqp_channel.c b/amqp-1.7.0/amqp_channel.c
similarity index 98%
rename from amqp-1.7.0alpha2/amqp_channel.c
rename to amqp-1.7.0/amqp_channel.c
index 69d71e6..889bb60 100644
--- a/amqp-1.7.0alpha2/amqp_channel.c
+++ b/amqp-1.7.0/amqp_channel.c
@@ -1,756 +1,760 @@
/*
+----------------------------------------------------------------------+
| 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 |
+----------------------------------------------------------------------+
*/
/* $Id: amqp_channel.c 318036 2011-10-11 20:30:46Z pdezwart $ */
#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_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 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) {
+ 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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
return;
}
php_amqp_maybe_release_buffers_on_channel(connection_resource, channel_resource);
}
}
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 TSRMLS_CC);
efree(channel->channel_resource);
channel->channel_resource = NULL;
}
zend_object_std_dtor(&channel->zo TSRMLS_CC);
#if PHP_MAJOR_VERSION < 7
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)
*/
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();
}
channel = PHP_AMQP_GET_CHANNEL(getThis());
/* 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;
/* 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_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
- php_amqp_connection_resource_unregister_channel(channel_resource->connection_resource, channel_resource->channel_id);
- channel_resource->channel_id = 0;
+ /* 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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
}
/* }}} */
/* {{{ proto bool amqp::isConnected()
check amqp channel */
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 amqp::getChannelId()
get amqp channel ID */
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 */
PHP_METHOD(amqp_channel_class, setPrefetchCount)
{
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t prefetch_count;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
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 */
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 */
PHP_METHOD(amqp_channel_class, setPrefetchSize)
{
amqp_channel_resource *channel_resource;
PHP5to7_param_long_type_t prefetch_size;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
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 */
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 */
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;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
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 */
PHP_METHOD(amqp_channel_class, startTransaction)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
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 */
PHP_METHOD(amqp_channel_class, commitTransaction)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
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 */
PHP_METHOD(amqp_channel_class, rollbackTransaction)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
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 */
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 */
PHP_METHOD(amqp_channel_class, basicRecover)
{
amqp_channel_resource *channel_resource;
amqp_rpc_reply_t res;
zend_bool requeue = 1;
/* Get the vhost from the method params */
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
PHP_AMQP_INIT_ERROR_MESSAGE();
php_amqp_error(res, PHP_AMQP_ERROR_MESSAGE_PTR, channel_resource->connection_resource, channel_resource TSRMLS_CC);
php_amqp_zend_throw_exception(res, amqp_channel_exception_class_entry, PHP_AMQP_ERROR_MESSAGE, 0 TSRMLS_CC);
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
PHP_AMQP_DESTROY_ERROR_MESSAGE();
return;
}
php_amqp_maybe_release_buffers_on_channel(channel_resource->connection_resource, channel_resource);
RETURN_TRUE;
}
/* }}} */
/* amqp_channel_class ARG_INFO definition */
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_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_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, 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)
{NULL, NULL, NULL} /* Must be the last line in amqp_functions[] */
};
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);
#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_connection_object, zo);
amqp_channel_object_handlers.free_obj = amqp_channel_free;
#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.7.0alpha2/amqp_channel.h b/amqp-1.7.0/amqp_channel.h
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_channel.h
rename to amqp-1.7.0/amqp_channel.h
diff --git a/amqp-1.7.0alpha2/amqp_connection.c b/amqp-1.7.0/amqp_connection.c
similarity index 93%
rename from amqp-1.7.0alpha2/amqp_connection.c
rename to amqp-1.7.0/amqp_connection.c
index c0146b8..3a14f0e 100644
--- a/amqp-1.7.0alpha2/amqp_connection.c
+++ b/amqp-1.7.0/amqp_connection.c
@@ -1,1319 +1,1298 @@
/*
+----------------------------------------------------------------------+
| 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>
#include <amqp_tcp_socket.h>
#ifdef PHP_WIN32
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
#include "php_amqp.h"
#include "amqp_channel.h"
#include "amqp_connection_resource.h"
#include "amqp_connection.h"
#ifndef E_DEPRECATED
#define E_DEPRECATED E_WARNING
#endif
zend_class_entry *amqp_connection_class_entry;
#define this_ce amqp_connection_class_entry
zend_object_handlers amqp_connection_object_handlers;
+static int php_amqp_connection_resource_deleter(PHP5to7_zend_resource_le_t *el, amqp_connection_resource *connection_resource TSRMLS_DC)
+{
+ if (Z_RES_P(el)->ptr == connection_resource) {
+ return ZEND_HASH_APPLY_REMOVE | ZEND_HASH_APPLY_STOP;
+ }
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+
+static PHP5to7_param_str_len_type_t php_amqp_get_connection_hash(amqp_connection_params *params, char **hash) {
+ return spprintf(hash,
+ 0,
+ "amqp_conn_res_h:%s_p:%d_v:%s_l:%s_p:%s_f:%d_c:%d_h:%d",
+ params->host,
+ params->port,
+ params->vhost,
+ params->login,
+ params->password,
+ params->frame_max,
+ params->channel_max,
+ params->heartbeat
+ );
+}
+
static void php_amqp_cleanup_connection_resource(amqp_connection_resource *connection_resource TSRMLS_DC)
{
if (!connection_resource) {
return;
}
PHP5to7_zend_resource_t resource = connection_resource->resource;
+ connection_resource->parent->connection_resource = NULL;
connection_resource->parent = NULL;
if (connection_resource->is_dirty) {
if (connection_resource->is_persistent) {
-
- PHP5to7_zend_resource_le_t *le = PHP5to7_ZEND_RESOURCE_LE_EMPTY;
-
- if (PHP5to7_ZEND_HASH_FIND(&EG(persistent_list), connection_resource->resource_key, connection_resource->resource_key_len + 1, le)) {
-
- if (PHP5to7_ZEND_RSRC_TYPE_P(Z_RES_P(le)) == le_amqp_connection_resource_persistent) {
- PHP5to7_ZEND_HASH_DEL(&EG(persistent_list), connection_resource->resource_key, (uint)(connection_resource->resource_key_len + 1));
- }
- }
+ zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t)php_amqp_connection_resource_deleter, (void*)connection_resource TSRMLS_CC);
}
zend_list_delete(resource);
} else {
if (connection_resource->is_persistent) {
connection_resource->resource = PHP5to7_ZEND_RESOURCE_EMPTY;
}
if (connection_resource->resource != PHP5to7_ZEND_RESOURCE_EMPTY) {
zend_list_delete(resource);
}
}
}
static void php_amqp_disconnect(amqp_connection_resource *resource TSRMLS_DC)
{
php_amqp_prepare_for_disconnect(resource TSRMLS_CC);
php_amqp_cleanup_connection_resource(resource TSRMLS_CC);
}
-static void php_amqp_disconnect_force(amqp_connection_resource *resource TSRMLS_DC)
+void php_amqp_disconnect_force(amqp_connection_resource *resource TSRMLS_DC)
{
php_amqp_prepare_for_disconnect(resource TSRMLS_CC);
resource->is_dirty = '\1';
php_amqp_cleanup_connection_resource(resource TSRMLS_CC);
}
/**
* php_amqp_connect
* handles connecting to amqp
* called by connect(), pconnect(), reconnect(), preconnect()
*/
int php_amqp_connect(amqp_connection_object *connection, zend_bool persistent, INTERNAL_FUNCTION_PARAMETERS)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
- char *key; PHP5to7_param_str_len_type_t key_len;
+ char *key = NULL;
+ PHP5to7_param_str_len_type_t key_len = 0;
if (connection->connection_resource) {
/* Clean up old memory allocations which are now invalid (new connection) */
php_amqp_cleanup_connection_resource(connection->connection_resource TSRMLS_CC);
-
- connection->connection_resource = NULL;
}
assert(connection->connection_resource == NULL);
amqp_connection_params connection_params;
connection_params.host = PHP_AMQP_READ_THIS_PROP_STR("host");
connection_params.port = (int)PHP_AMQP_READ_THIS_PROP_LONG("port");
connection_params.vhost = PHP_AMQP_READ_THIS_PROP_STR("vhost");
connection_params.login = PHP_AMQP_READ_THIS_PROP_STR("login");
connection_params.password = PHP_AMQP_READ_THIS_PROP_STR("password");
connection_params.frame_max = (int) PHP_AMQP_READ_THIS_PROP_LONG("frame_max");
connection_params.channel_max = (int) PHP_AMQP_READ_THIS_PROP_LONG("channel_max");
connection_params.heartbeat = (int) PHP_AMQP_READ_THIS_PROP_LONG("heartbeat");
connection_params.read_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("read_timeout");
connection_params.write_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("write_timeout");
connection_params.connect_timeout = PHP_AMQP_READ_THIS_PROP_DOUBLE("connect_timeout");
if (persistent) {
PHP5to7_zend_resource_store_t *le = PHP5to7_ZEND_RESOURCE_EMPTY;
/* Look for an established resource */
- key_len = spprintf(&key, 0,
- "amqp_conn_res_%s_%d_%s_%s_%s_%d_%d_%d",
- connection_params.host,
- connection_params.port,
- connection_params.vhost,
- connection_params.login,
- connection_params.password,
- connection_params.frame_max,
- connection_params.channel_max,
- connection_params.heartbeat
- );
-
- if (PHP5to7_ZEND_HASH_STR_FIND_PTR(&EG(persistent_list), key, key_len + 1, le)) {
+ key_len = php_amqp_get_connection_hash(&connection_params, &key);
+
+ if (PHP5to7_ZEND_HASH_STR_FIND_PTR(&EG(persistent_list), key, key_len, le)) {
efree(key);
if (le->type != le_amqp_connection_resource_persistent) {
/* hash conflict, given name associate with non-amqp persistent connection resource */
return 0;
}
/* An entry for this connection resource already exists */
/* Stash the connection resource in the connection */
connection->connection_resource = le->ptr;
if (connection->connection_resource->resource != PHP5to7_ZEND_RESOURCE_EMPTY) {
/* resource in use! */
connection->connection_resource = NULL;
zend_throw_exception(amqp_connection_exception_class_entry, "There are already established persistent connection to the same resource.", 0 TSRMLS_CC);
return 0;
}
connection->connection_resource->resource = PHP5to7_ZEND_REGISTER_RESOURCE(connection->connection_resource, persistent ? le_amqp_connection_resource_persistent : le_amqp_connection_resource);
connection->connection_resource->parent = connection;
/* Set desired timeouts */
if (php_amqp_set_resource_read_timeout(connection->connection_resource, PHP_AMQP_READ_THIS_PROP_DOUBLE("read_timeout") TSRMLS_CC) == 0
|| php_amqp_set_resource_write_timeout(connection->connection_resource, PHP_AMQP_READ_THIS_PROP_DOUBLE("write_timeout") TSRMLS_CC) == 0) {
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
return 0;
}
/* Set connection status to connected */
connection->connection_resource->is_connected = '\1';
connection->connection_resource->is_persistent = persistent;
return 1;
}
efree(key);
}
connection->connection_resource = connection_resource_constructor(&connection_params, persistent TSRMLS_CC);
if (connection->connection_resource == NULL) {
return 0;
}
connection->connection_resource->resource = PHP5to7_ZEND_REGISTER_RESOURCE(connection->connection_resource, persistent ? le_amqp_connection_resource_persistent : le_amqp_connection_resource);
connection->connection_resource->parent = connection;
/* Set connection status to connected */
connection->connection_resource->is_connected = '\1';
if (persistent) {
connection->connection_resource->is_persistent = persistent;
- key_len = spprintf(&key, 0,
- "amqp_conn_res_%s_%d_%s_%s_%s_%d_%d_%d",
- connection_params.host,
- connection_params.port,
- connection_params.vhost,
- connection_params.login,
- connection_params.password,
- connection_params.frame_max,
- connection_params.channel_max,
- connection_params.heartbeat
- );
-
- connection->connection_resource->resource_key = pestrndup(key, (uint) key_len, persistent);
- connection->connection_resource->resource_key_len = key_len;
-
- efree(key);
+ key_len = php_amqp_get_connection_hash(&connection_params, &key);
PHP5to7_zend_resource_store_t new_le;
/* Store a reference in the persistence list */
new_le.ptr = connection->connection_resource;
new_le.type = persistent ? le_amqp_connection_resource_persistent : le_amqp_connection_resource;
- if (!PHP5to7_ZEND_HASH_STR_UPD_MEM(&EG(persistent_list), connection->connection_resource->resource_key, connection->connection_resource->resource_key_len + 1, new_le, sizeof(PHP5to7_zend_resource_store_t))) {
+ if (!PHP5to7_ZEND_HASH_STR_UPD_MEM(&EG(persistent_list), key, key_len, new_le, sizeof(PHP5to7_zend_resource_store_t))) {
+ efree(key);
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
return 0;
}
+ efree(key);
}
return 1;
}
void amqp_connection_free(PHP5to7_obj_free_zend_object *object TSRMLS_DC)
{
amqp_connection_object *connection = PHP_AMQP_FETCH_CONNECTION(object);
if (connection->connection_resource) {
php_amqp_disconnect(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
}
zend_object_std_dtor(&connection->zo TSRMLS_CC);
#if PHP_MAJOR_VERSION < 7
efree(object);
#endif
}
PHP5to7_zend_object_value amqp_connection_ctor(zend_class_entry *ce TSRMLS_DC)
{
amqp_connection_object* connection = PHP5to7_ECALLOC_CONNECTION_OBJECT(ce);
zend_object_std_init(&connection->zo, ce TSRMLS_CC);
AMQP_OBJECT_PROPERTIES_INIT(connection->zo, ce);
#if PHP_MAJOR_VERSION >=7
connection->zo.handlers = &amqp_connection_object_handlers;
return &connection->zo;
#else
PHP5to7_zend_object_value new_value;
new_value.handle = zend_objects_store_put(
connection,
NULL,
(zend_objects_free_object_storage_t) amqp_connection_free,
NULL TSRMLS_CC
);
new_value.handlers = zend_get_std_object_handlers();
return new_value;
#endif
}
/* {{{ proto AMQPConnection::__construct([array optional])
* The array can contain 'host', 'port', 'login', 'password', 'vhost', 'read_timeout', 'write_timeout', 'connect_timeout' and 'timeout' (deprecated) indexes
*/
PHP_METHOD(amqp_connection_class, __construct)
{
zval* ini_arr = NULL;
PHP5to7_zval_t *zdata = NULL;
/* Parse out the method parameters */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", &ini_arr) == FAILURE) {
return;
}
/* Pull the login out of the $params array */
zdata = NULL;
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "login", sizeof("login"), zdata)) {
// TODO: check whether we need separate zval
convert_to_string(PHP5to7_MAYBE_DEREF(zdata));
}
/* Validate the given login */
if (zdata && Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) > 0) {
if (Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) < 128) {
zend_update_property(this_ce, getThis(), ZEND_STRL("login"), PHP5to7_MAYBE_DEREF(zdata)TSRMLS_CC);
} else {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'login' exceeds 128 character limit.", 0 TSRMLS_CC);
return;
}
} else {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("login"), INI_STR("amqp.login"), (PHP5to7_param_str_len_type_t) (strlen(INI_STR("amqp.login")) > 128 ? 128 : strlen(INI_STR("amqp.login"))) TSRMLS_CC);
}
/* Pull the password out of the $params array */
zdata = NULL;
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "password", sizeof("password"), zdata)) {
convert_to_string(PHP5to7_MAYBE_DEREF(zdata));
}
/* Validate the given password */
if (zdata && Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) > 0) {
if (Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) < 128) {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("password"), Z_STRVAL_P(PHP5to7_MAYBE_DEREF(zdata)), Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
} else {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'password' exceeds 128 character limit.", 0 TSRMLS_CC);
return;
}
} else {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("password"), INI_STR("amqp.password"), (PHP5to7_param_str_len_type_t) (strlen(INI_STR("amqp.password")) > 128 ? 128 : strlen(INI_STR("amqp.login"))) TSRMLS_CC);
}
/* Pull the host out of the $params array */
zdata = NULL;
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "host", sizeof("host"), zdata)) {
convert_to_string(PHP5to7_MAYBE_DEREF(zdata));
}
/* Validate the given host */
if (zdata && Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) > 0) {
if (Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) < 128) {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("host"), Z_STRVAL_P(PHP5to7_MAYBE_DEREF(zdata)), Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
} else {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'host' exceeds 128 character limit.", 0 TSRMLS_CC);
return;
}
} else {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("host"), INI_STR("amqp.host"), (PHP5to7_param_str_len_type_t) (strlen(INI_STR("amqp.host")) > 128 ? 128 : strlen(INI_STR("amqp.host"))) TSRMLS_CC);
}
/* Pull the vhost out of the $params array */
zdata = NULL;
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "vhost", sizeof("vhost"), zdata)) {
convert_to_string(PHP5to7_MAYBE_DEREF(zdata));
}
/* Validate the given vhost */
if (zdata && Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) > 0) {
if (Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) < 128) {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("vhost"), Z_STRVAL_P(PHP5to7_MAYBE_DEREF(zdata)), Z_STRLEN_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
} else {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'vhost' exceeds 128 character limit.", 0 TSRMLS_CC);
return;
}
} else {
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("vhost"), INI_STR("amqp.vhost"), (PHP5to7_param_str_len_type_t) (strlen(INI_STR("amqp.vhost")) > 128 ? 128 : strlen(INI_STR("amqp.vhost"))) TSRMLS_CC);
}
zend_update_property_long(this_ce, getThis(), ZEND_STRL("port"), INI_INT("amqp.port") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "port", sizeof("port"), zdata)) {
convert_to_long(PHP5to7_MAYBE_DEREF(zdata));
zend_update_property_long(this_ce, getThis(), ZEND_STRL("port"), Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), INI_FLT("amqp.read_timeout") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "read_timeout", sizeof("read_timeout"), zdata)) {
convert_to_double(PHP5to7_MAYBE_DEREF(zdata));
if (Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'read_timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
} else {
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "timeout", sizeof("timeout"), zdata)) {
/* 'read_timeout' takes precedence on 'timeout' but users have to know this */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter 'timeout' is deprecated, 'read_timeout' used instead");
}
} else if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "timeout", sizeof("timeout"), zdata)) {
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "Parameter 'timeout' is deprecated; use 'read_timeout' instead");
convert_to_double(PHP5to7_MAYBE_DEREF(zdata));
if (Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
} else {
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
} else {
assert(DEFAULT_TIMEOUT != NULL);
if (strcmp(DEFAULT_TIMEOUT, INI_STR("amqp.timeout")) != 0) {
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "INI setting 'amqp.timeout' is deprecated; use 'amqp.read_timeout' instead");
if (strcmp(DEFAULT_READ_TIMEOUT, INI_STR("amqp.read_timeout")) == 0) {
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), INI_FLT("amqp.timeout") TSRMLS_CC);
} else {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "INI setting 'amqp.read_timeout' will be used instead of 'amqp.timeout'");
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), INI_FLT("amqp.read_timeout") TSRMLS_CC);
}
} else {
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), INI_FLT("amqp.read_timeout") TSRMLS_CC);
}
}
zend_update_property_double(this_ce, getThis(), ZEND_STRL("write_timeout"), INI_FLT("amqp.write_timeout") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "write_timeout", sizeof("write_timeout"), zdata)) {
convert_to_double(PHP5to7_MAYBE_DEREF(zdata));
if (Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'write_timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
} else {
zend_update_property_double(this_ce, getThis(), ZEND_STRL("write_timeout"), Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
}
zend_update_property_double(this_ce, getThis(), ZEND_STRL("connect_timeout"), INI_FLT("amqp.connect_timeout") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "connect_timeout", sizeof("connect_timeout"), zdata)) {
convert_to_double(PHP5to7_MAYBE_DEREF(zdata));
if (Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'connect_timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
} else {
zend_update_property_double(this_ce, getThis(), ZEND_STRL("connect_timeout"), Z_DVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
}
zend_update_property_long(this_ce, getThis(), ZEND_STRL("channel_max"), INI_INT("amqp.channel_max") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "channel_max", sizeof("channel_max"), zdata)) {
convert_to_long(PHP5to7_MAYBE_DEREF(zdata));
if (Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0 || Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) > PHP_AMQP_MAX_CHANNELS) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'channel_max' is out of range.", 0 TSRMLS_CC);
} else {
if(Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) == 0) {
zend_update_property_long(this_ce, getThis(), ZEND_STRL("channel_max"), PHP_AMQP_DEFAULT_CHANNEL_MAX TSRMLS_CC);
} else {
zend_update_property_long(this_ce, getThis(), ZEND_STRL("channel_max"), Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
}
}
zend_update_property_long(this_ce, getThis(), ZEND_STRL("frame_max"), INI_INT("amqp.frame_max") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "frame_max", sizeof("frame_max"), zdata)) {
convert_to_long(PHP5to7_MAYBE_DEREF(zdata));
if (Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0 || Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) > PHP_AMQP_MAX_FRAME) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'frame_max' is out of range.", 0 TSRMLS_CC);
} else {
if(Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) == 0) {
zend_update_property_long(this_ce, getThis(), ZEND_STRL("frame_max"), PHP_AMQP_DEFAULT_FRAME_MAX TSRMLS_CC);
} else {
zend_update_property_long(this_ce, getThis(), ZEND_STRL("frame_max"), Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
}
}
zend_update_property_long(this_ce, getThis(), ZEND_STRL("heartbeat"), INI_INT("amqp.heartbeat") TSRMLS_CC);
if (ini_arr && PHP5to7_ZEND_HASH_FIND(HASH_OF(ini_arr), "heartbeat", sizeof("heartbeat"), zdata)) {
convert_to_long(PHP5to7_MAYBE_DEREF(zdata));
if (Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) < 0 || Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) > PHP_AMQP_MAX_HEARTBEAT) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'heartbeat' is out of range.", 0 TSRMLS_CC);
} else {
zend_update_property_long(this_ce, getThis(), ZEND_STRL("heartbeat"), Z_LVAL_P(PHP5to7_MAYBE_DEREF(zdata)) TSRMLS_CC);
}
}
}
/* }}} */
/* {{{ proto amqp::isConnected()
check amqp connection */
PHP_METHOD(amqp_connection_class, isConnected)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
/* If the channel_connect is 1, we have a connection */
if (connection->connection_resource != NULL && connection->connection_resource->is_connected) {
RETURN_TRUE;
}
/* We have no connection */
RETURN_FALSE;
}
/* }}} */
/* {{{ proto amqp::connect()
create amqp connection */
PHP_METHOD(amqp_connection_class, connect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (connection->connection_resource->is_persistent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to start transient connection while persistent transient one already established. Continue.");
}
RETURN_TRUE;
}
/* Actually connect this resource to the broker */
RETURN_BOOL(php_amqp_connect(connection, 0, INTERNAL_FUNCTION_PARAM_PASSTHRU));
}
/* }}} */
/* {{{ proto amqp::connect()
create amqp connection */
PHP_METHOD(amqp_connection_class, pconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
assert(connection->connection_resource != NULL);
if (!connection->connection_resource->is_persistent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to start persistent connection while transient one already established. Continue.");
}
RETURN_TRUE;
}
/* Actually connect this resource to the broker or use stored connection */
RETURN_BOOL(php_amqp_connect(connection, 1, INTERNAL_FUNCTION_PARAM_PASSTHRU));
}
/* }}} */
/* {{{ proto amqp:pdisconnect()
destroy amqp persistent connection */
PHP_METHOD(amqp_connection_class, pdisconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (!connection->connection_resource || !connection->connection_resource->is_connected) {
RETURN_TRUE;
}
assert(connection->connection_resource != NULL);
if (!connection->connection_resource->is_persistent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close persistent connection while transient one already established. Abort.");
RETURN_FALSE;
}
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::disconnect()
destroy amqp connection */
PHP_METHOD(amqp_connection_class, disconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (!connection->connection_resource || !connection->connection_resource->is_connected) {
RETURN_TRUE;
}
if (connection->connection_resource->is_persistent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close transient connection while persistent one already established. Abort.");
RETURN_FALSE;
}
assert(connection->connection_resource != NULL);
php_amqp_disconnect(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::reconnect()
recreate amqp connection */
PHP_METHOD(amqp_connection_class, reconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
assert(connection->connection_resource != NULL);
if (connection->connection_resource->is_persistent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to reconnect persistent connection while transient one already established. Abort.");
RETURN_FALSE;
}
php_amqp_disconnect(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
}
RETURN_BOOL(php_amqp_connect(connection, 0, INTERNAL_FUNCTION_PARAM_PASSTHRU));
}
/* }}} */
/* {{{ proto amqp::preconnect()
recreate amqp connection */
PHP_METHOD(amqp_connection_class, preconnect)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (connection->connection_resource && connection->connection_resource->is_connected) {
assert(connection->connection_resource != NULL);
if (!connection->connection_resource->is_persistent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to reconnect transient connection while persistent one already established. Abort.");
RETURN_FALSE;
}
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
}
RETURN_BOOL(php_amqp_connect(connection, 1, INTERNAL_FUNCTION_PARAM_PASSTHRU));
}
/* }}} */
/* {{{ proto amqp::getLogin()
get the login */
PHP_METHOD(amqp_connection_class, getLogin)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("login");
}
/* }}} */
/* {{{ proto amqp::setLogin(string login)
set the login */
PHP_METHOD(amqp_connection_class, setLogin)
{
char *login = NULL; PHP5to7_param_str_len_type_t login_len = 0;
/* Get the login from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &login, &login_len) == FAILURE) {
return;
}
/* Validate login length */
if (login_len > 128) {
zend_throw_exception(amqp_connection_exception_class_entry, "Invalid 'login' given, exceeds 128 characters limit.", 0 TSRMLS_CC);
return;
}
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("login"), login, login_len TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getPassword()
get the password */
PHP_METHOD(amqp_connection_class, getPassword)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("password");
}
/* }}} */
/* {{{ proto amqp::setPassword(string password)
set the password */
PHP_METHOD(amqp_connection_class, setPassword)
{
char *password = NULL; PHP5to7_param_str_len_type_t password_len = 0;
/* Get the password from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &password, &password_len) == FAILURE) {
return;
}
/* Validate password length */
if (password_len > 128) {
zend_throw_exception(amqp_connection_exception_class_entry, "Invalid 'password' given, exceeds 128 characters limit.", 0 TSRMLS_CC);
return;
}
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("password"), password, password_len TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getHost()
get the host */
PHP_METHOD(amqp_connection_class, getHost)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("host");
}
/* }}} */
/* {{{ proto amqp::setHost(string host)
set the host */
PHP_METHOD(amqp_connection_class, setHost)
{
char *host = NULL; PHP5to7_param_str_len_type_t host_len = 0;
/* Get the host from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &host, &host_len) == FAILURE) {
return;
}
/* Validate host length */
if (host_len > 1024) {
zend_throw_exception(amqp_connection_exception_class_entry, "Invalid 'host' given, exceeds 1024 character limit.", 0 TSRMLS_CC);
return;
}
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("host"), host, host_len TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getPort()
get the port */
PHP_METHOD(amqp_connection_class, getPort)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("port");
}
/* }}} */
/* {{{ proto amqp::setPort(mixed port)
set the port */
PHP_METHOD(amqp_connection_class, setPort)
{
zval *zvalPort;
int port;
/* Get the port from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zvalPort) == FAILURE) {
return;
}
/* Parse out the port*/
switch (Z_TYPE_P(zvalPort)) {
case IS_DOUBLE:
port = (int)Z_DVAL_P(zvalPort);
break;
case IS_LONG:
port = (int)Z_LVAL_P(zvalPort);
break;
case IS_STRING:
convert_to_long(zvalPort);
port = (int)Z_LVAL_P(zvalPort);
break;
default:
port = 0;
}
/* Check the port value */
if (port <= 0 || port > 65535) {
zend_throw_exception(amqp_connection_exception_class_entry, "Invalid port given. Value must be between 1 and 65535.", 0 TSRMLS_CC);
return;
}
zend_update_property_long(this_ce, getThis(), ZEND_STRL("port"), port TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getVhost()
get the vhost */
PHP_METHOD(amqp_connection_class, getVhost)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("vhost");
}
/* }}} */
/* {{{ proto amqp::setVhost(string vhost)
set the vhost */
PHP_METHOD(amqp_connection_class, setVhost)
{
char *vhost = NULL; PHP5to7_param_str_len_type_t vhost_len = 0;
/* Get the vhost from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &vhost, &vhost_len) == FAILURE) {
return;
}
/* Validate vhost length */
if (vhost_len > 128) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'vhost' exceeds 128 characters limit.", 0 TSRMLS_CC);
return;
}
zend_update_property_stringl(this_ce, getThis(), ZEND_STRL("vhost"), vhost, vhost_len TSRMLS_CC);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getTimeout()
@deprecated
get the timeout */
PHP_METHOD(amqp_connection_class, getTimeout)
{
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "AMQPConnection::getTimeout() method is deprecated; use AMQPConnection::getReadTimeout() instead");
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("read_timeout");
}
/* }}} */
/* {{{ proto amqp::setTimeout(double timeout)
@deprecated
set the timeout */
PHP_METHOD(amqp_connection_class, setTimeout)
{
amqp_connection_object *connection;
double read_timeout;
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "AMQPConnection::setTimeout($timeout) method is deprecated; use AMQPConnection::setReadTimeout($timeout) instead");
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &read_timeout) == FAILURE) {
return;
}
/* Validate timeout */
if (read_timeout < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), read_timeout TSRMLS_CC);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_read_timeout(connection->connection_resource, read_timeout TSRMLS_CC) == 0) {
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
RETURN_FALSE;
}
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getReadTimeout()
get the read timeout */
PHP_METHOD(amqp_connection_class, getReadTimeout)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("read_timeout");
}
/* }}} */
/* {{{ proto amqp::setReadTimeout(double timeout)
set read timeout */
PHP_METHOD(amqp_connection_class, setReadTimeout)
{
amqp_connection_object *connection;
double read_timeout;
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &read_timeout) == FAILURE) {
return;
}
/* Validate timeout */
if (read_timeout < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'read_timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, getThis(), ZEND_STRL("read_timeout"), read_timeout TSRMLS_CC);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_read_timeout(connection->connection_resource, read_timeout TSRMLS_CC) == 0) {
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
RETURN_FALSE;
}
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getWriteTimeout()
get write timeout */
PHP_METHOD(amqp_connection_class, getWriteTimeout)
{
PHP5to7_READ_PROP_RV_PARAM_DECL;
PHP_AMQP_NOPARAMS();
PHP_AMQP_RETURN_THIS_PROP("write_timeout");
}
/* }}} */
/* {{{ proto amqp::setWriteTimeout(double timeout)
set write timeout */
PHP_METHOD(amqp_connection_class, setWriteTimeout)
{
amqp_connection_object *connection;
double write_timeout;
/* Get the timeout from the method params */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &write_timeout) == FAILURE) {
return;
}
/* Validate timeout */
if (write_timeout < 0) {
zend_throw_exception(amqp_connection_exception_class_entry, "Parameter 'write_timeout' must be greater than or equal to zero.", 0 TSRMLS_CC);
return;
}
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
zend_update_property_double(this_ce, getThis(), ZEND_STRL("write_timeout"), write_timeout TSRMLS_CC);
if (connection->connection_resource && connection->connection_resource->is_connected) {
if (php_amqp_set_resource_write_timeout(connection->connection_resource, write_timeout TSRMLS_CC) == 0) {
php_amqp_disconnect_force(connection->connection_resource TSRMLS_CC);
- connection->connection_resource = NULL;
RETURN_FALSE;
}
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto amqp::getUsedChannels()
Get max used channels number */
PHP_METHOD(amqp_connection_class, getUsedChannels)
{
amqp_connection_object *connection;
/* Get the timeout from the method params */
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
if (!connection->connection_resource || !connection->connection_resource->is_connected) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection is not connected.");
RETURN_LONG(0);
}
RETURN_LONG(connection->connection_resource->used_slots);
}
/* }}} */
/* {{{ proto amqp::getMaxChannels()
Get max supported channels number per connection */
PHP_METHOD(amqp_connection_class, getMaxChannels)
{
+ PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
- if (!connection->connection_resource || !connection->connection_resource->is_connected) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection is not connected.");
-
- RETURN_NULL();
+ if (connection->connection_resource && connection->connection_resource->is_connected) {
+ RETURN_LONG(connection->connection_resource->max_slots);
}
- RETURN_LONG(connection->connection_resource->max_slots);
+ PHP_AMQP_RETURN_THIS_PROP("channel_max");
}
/* }}} */
-#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH > 52
/* {{{ proto amqp::getMaxFrameSize()
Get max supported frame size per connection in bytes */
PHP_METHOD(amqp_connection_class, getMaxFrameSize)
{
+ PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
- if (!connection->connection_resource || !connection->connection_resource->is_connected) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection is not connected.");
-
- RETURN_NULL();
+#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH > 52
+ if (connection->connection_resource && connection->connection_resource->is_connected) {
+ RETURN_LONG(amqp_get_frame_max(connection->connection_resource->connection_state));
}
+#endif
- RETURN_LONG(amqp_get_frame_max(connection->connection_resource->connection_state));
+ PHP_AMQP_RETURN_THIS_PROP("frame_max");
}
/* }}} */
/* {{{ proto amqp::getHeartbeatInterval()
Get number of seconds between heartbeats of the connection in seconds */
PHP_METHOD(amqp_connection_class, getHeartbeatInterval)
{
+ PHP5to7_READ_PROP_RV_PARAM_DECL;
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
/* Get the connection object out of the store */
connection = PHP_AMQP_GET_CONNECTION(getThis());
- if (!connection->connection_resource || !connection->connection_resource->is_connected) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection is not connected.");
-
- RETURN_NULL();
+#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH > 52
+ if (connection->connection_resource != NULL
+ && connection->connection_resource->is_connected != '\0') {
+ RETURN_LONG(amqp_get_heartbeat(connection->connection_resource->connection_state));
}
+#endif
- RETURN_LONG(amqp_get_heartbeat(connection->connection_resource->connection_state));
+ PHP_AMQP_RETURN_THIS_PROP("heartbeat");
}
/* }}} */
-#endif
/* {{{ proto amqp::isPersistent()
check whether amqp connection is persistent */
PHP_METHOD(amqp_connection_class, isPersistent)
{
amqp_connection_object *connection;
PHP_AMQP_NOPARAMS();
connection = PHP_AMQP_GET_CONNECTION(getThis());
RETURN_BOOL(connection->connection_resource && connection->connection_resource->is_persistent);
}
/* }}} */
/* amqp_connection_class ARG_INFO definition */
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class__construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_ARG_ARRAY_INFO(0, credentials, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_isConnected, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_connect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_pconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_pdisconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_disconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_reconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_preconnect, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getLogin, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setLogin, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, login)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getPassword, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setPassword, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, password)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getHost, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setHost, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, host)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getPort, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setPort, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, port)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getVhost, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setVhost, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, vhost)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getTimeout, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setTimeout, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, timeout)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getReadTimeout, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setReadTimeout, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, timeout)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getWriteTimeout, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_setWriteTimeout, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, timeout)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getUsedChannels, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getMaxChannels, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
-#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH > 52
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getMaxFrameSize, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_getHeartbeatInterval, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
-#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_amqp_connection_class_isPersistent, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
zend_function_entry amqp_connection_class_functions[] = {
PHP_ME(amqp_connection_class, __construct, arginfo_amqp_connection_class__construct, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, isConnected, arginfo_amqp_connection_class_isConnected, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, connect, arginfo_amqp_connection_class_connect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, pconnect, arginfo_amqp_connection_class_pconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, pdisconnect, arginfo_amqp_connection_class_pdisconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, disconnect, arginfo_amqp_connection_class_disconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, reconnect, arginfo_amqp_connection_class_reconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, preconnect, arginfo_amqp_connection_class_preconnect, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getLogin, arginfo_amqp_connection_class_getLogin, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setLogin, arginfo_amqp_connection_class_setLogin, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getPassword, arginfo_amqp_connection_class_getPassword, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setPassword, arginfo_amqp_connection_class_setPassword, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getHost, arginfo_amqp_connection_class_getHost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setHost, arginfo_amqp_connection_class_setHost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getPort, arginfo_amqp_connection_class_getPort, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setPort, arginfo_amqp_connection_class_setPort, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getVhost, arginfo_amqp_connection_class_getVhost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setVhost, arginfo_amqp_connection_class_setVhost, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getTimeout, arginfo_amqp_connection_class_getTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setTimeout, arginfo_amqp_connection_class_setTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getReadTimeout, arginfo_amqp_connection_class_getReadTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setReadTimeout, arginfo_amqp_connection_class_setReadTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getWriteTimeout, arginfo_amqp_connection_class_getWriteTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, setWriteTimeout, arginfo_amqp_connection_class_setWriteTimeout, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getUsedChannels, arginfo_amqp_connection_class_getUsedChannels, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getMaxChannels, arginfo_amqp_connection_class_getMaxChannels, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, isPersistent, arginfo_amqp_connection_class_isPersistent, ZEND_ACC_PUBLIC)
-#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH > 52
PHP_ME(amqp_connection_class, getHeartbeatInterval, arginfo_amqp_connection_class_getHeartbeatInterval, ZEND_ACC_PUBLIC)
PHP_ME(amqp_connection_class, getMaxFrameSize, arginfo_amqp_connection_class_getMaxFrameSize, ZEND_ACC_PUBLIC)
-#endif
+
{NULL, NULL, NULL} /* Must be the last line in amqp_functions[] */
};
PHP_MINIT_FUNCTION(amqp_connection)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "AMQPConnection", amqp_connection_class_functions);
ce.create_object = amqp_connection_ctor;
this_ce = zend_register_internal_class(&ce TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("login"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("password"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("host"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("vhost"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("port"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("read_timeout"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("write_timeout"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("connect_timeout"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("channel_max"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("frame_max"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(this_ce, ZEND_STRL("heartbeat"), ZEND_ACC_PRIVATE TSRMLS_CC);
#if PHP_MAJOR_VERSION >=7
memcpy(&amqp_connection_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
amqp_connection_object_handlers.offset = XtOffsetOf(amqp_connection_object, zo);
amqp_connection_object_handlers.free_obj = amqp_connection_free;
#endif
return SUCCESS;
}
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<6
*/
diff --git a/amqp-1.7.0alpha2/amqp_connection.h b/amqp-1.7.0/amqp_connection.h
similarity index 97%
rename from amqp-1.7.0alpha2/amqp_connection.h
rename to amqp-1.7.0/amqp_connection.h
index ccebc07..7c7433d 100644
--- a/amqp-1.7.0alpha2/amqp_connection.h
+++ b/amqp-1.7.0/amqp_connection.h
@@ -1,80 +1,79 @@
/*
+----------------------------------------------------------------------+
| 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 |
+----------------------------------------------------------------------+
*/
/* $Id: amqp_connection.h 326660 2012-07-17 05:32:34Z pdezwart $ */
extern zend_class_entry *amqp_connection_class_entry;
int php_amqp_connect(amqp_connection_object *amqp_connection, zend_bool persistent, INTERNAL_FUNCTION_PARAMETERS);
+void php_amqp_disconnect_force(amqp_connection_resource *resource TSRMLS_DC);
PHP_METHOD(amqp_connection_class, __construct);
PHP_METHOD(amqp_connection_class, isConnected);
PHP_METHOD(amqp_connection_class, connect);
PHP_METHOD(amqp_connection_class, pconnect);
PHP_METHOD(amqp_connection_class, pdisconnect);
PHP_METHOD(amqp_connection_class, disconnect);
PHP_METHOD(amqp_connection_class, reconnect);
PHP_METHOD(amqp_connection_class, preconnect);
PHP_METHOD(amqp_connection_class, getLogin);
PHP_METHOD(amqp_connection_class, setLogin);
PHP_METHOD(amqp_connection_class, getPassword);
PHP_METHOD(amqp_connection_class, setPassword);
PHP_METHOD(amqp_connection_class, getHost);
PHP_METHOD(amqp_connection_class, setHost);
PHP_METHOD(amqp_connection_class, getPort);
PHP_METHOD(amqp_connection_class, setPort);
PHP_METHOD(amqp_connection_class, getVhost);
PHP_METHOD(amqp_connection_class, setVhost);
PHP_METHOD(amqp_connection_class, getTimeout);
PHP_METHOD(amqp_connection_class, setTimeout);
PHP_METHOD(amqp_connection_class, getReadTimeout);
PHP_METHOD(amqp_connection_class, setReadTimeout);
PHP_METHOD(amqp_connection_class, getWriteTimeout);
PHP_METHOD(amqp_connection_class, setWriteTimeout);
PHP_METHOD(amqp_connection_class, getUsedChannels);
PHP_METHOD(amqp_connection_class, getMaxChannels);
-#if AMQP_VERSION_MAJOR * 100 + AMQP_VERSION_MINOR * 10 + AMQP_VERSION_PATCH > 52
PHP_METHOD(amqp_connection_class, getHeartbeatInterval);
PHP_METHOD(amqp_connection_class, getMaxFrameSize);
-#endif
PHP_METHOD(amqp_connection_class, isPersistent);
PHP_MINIT_FUNCTION(amqp_connection);
/*
*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.7.0alpha2/amqp_connection_resource.c b/amqp-1.7.0/amqp_connection_resource.c
similarity index 99%
rename from amqp-1.7.0alpha2/amqp_connection_resource.c
rename to amqp-1.7.0/amqp_connection_resource.c
index bc42389..20b88f9 100644
--- a/amqp-1.7.0alpha2/amqp_connection_resource.c
+++ b/amqp-1.7.0/amqp_connection_resource.c
@@ -1,504 +1,500 @@
/*
+----------------------------------------------------------------------+
| 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 |
+----------------------------------------------------------------------+
*/
/* $Id: amqp_connection.c 327551 2012-09-09 03:49:34Z pdezwart $ */
#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_framing.h>
#include <amqp_tcp_socket.h>
#ifdef PHP_WIN32
# include "win32/unistd.h"
#else
# include <unistd.h>
#endif
#include "php_amqp.h"
#include "amqp_channel.h"
#include "amqp_connection_resource.h"
#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);
/* 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: {
amqp_connection_close_t *m = (amqp_connection_close_t *)reply.reply.decoded;
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;
amqp_send_method(
resource->connection_state,
0, /* NOTE: 0-channel is reserved for things like this */
AMQP_CONNECTION_CLOSE_OK_METHOD,
&decoded
);
/* Prevent finishing AMQP connection in connection resource destructor */
resource->is_connected = '\0';
return PHP_AMQP_RESOURCE_RESPONSE_ERROR_CONNECTION_CLOSED;
}
case AMQP_CHANNEL_CLOSE_METHOD: {
assert(channel_id > 0 && channel_id <= resource->max_slots);
amqp_channel_close_t *m = (amqp_channel_close_t *) reply.reply.decoded;
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.
*/
amqp_channel_close_ok_t *decoded = (amqp_channel_close_ok_t *) NULL;
amqp_send_method(
resource->connection_state,
channel_id,
AMQP_CHANNEL_CLOSE_OK_METHOD,
&decoded
);
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*/
}
/* 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(connection->read_timeout * 1.e+3 - .5e+3, 1.));
+ 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 */
resource->socket = amqp_tcp_socket_new(resource->connection_state);
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 (res.reply_type != AMQP_RESPONSE_NORMAL) {
char *message, *long_message;
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, 0 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);
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
- if (resource->resource_key_len) {
- pefree(resource->resource_key, persistent);
- }
-
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] 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.7.0alpha2/amqp_connection_resource.h b/amqp-1.7.0/amqp_connection_resource.h
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_connection_resource.h
rename to amqp-1.7.0/amqp_connection_resource.h
diff --git a/amqp-1.7.0alpha2/amqp_envelope.c b/amqp-1.7.0/amqp_envelope.c
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_envelope.c
rename to amqp-1.7.0/amqp_envelope.c
diff --git a/amqp-1.7.0alpha2/amqp_envelope.h b/amqp-1.7.0/amqp_envelope.h
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_envelope.h
rename to amqp-1.7.0/amqp_envelope.h
diff --git a/amqp-1.7.0alpha2/amqp_exchange.c b/amqp-1.7.0/amqp_exchange.c
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_exchange.c
rename to amqp-1.7.0/amqp_exchange.c
diff --git a/amqp-1.7.0alpha2/amqp_exchange.h b/amqp-1.7.0/amqp_exchange.h
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_exchange.h
rename to amqp-1.7.0/amqp_exchange.h
diff --git a/amqp-1.7.0alpha2/amqp_queue.c b/amqp-1.7.0/amqp_queue.c
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_queue.c
rename to amqp-1.7.0/amqp_queue.c
diff --git a/amqp-1.7.0alpha2/amqp_queue.h b/amqp-1.7.0/amqp_queue.h
similarity index 100%
rename from amqp-1.7.0alpha2/amqp_queue.h
rename to amqp-1.7.0/amqp_queue.h
diff --git a/amqp-1.7.0alpha2/benchmark.php b/amqp-1.7.0/benchmark.php
similarity index 100%
rename from amqp-1.7.0alpha2/benchmark.php
rename to amqp-1.7.0/benchmark.php
diff --git a/amqp-1.7.0alpha2/config.m4 b/amqp-1.7.0/config.m4
similarity index 63%
rename from amqp-1.7.0alpha2/config.m4
rename to amqp-1.7.0/config.m4
index c44104d..a6f7a1f 100644
--- a/amqp-1.7.0alpha2/config.m4
+++ b/amqp-1.7.0/config.m4
@@ -1,89 +1,131 @@
dnl $Id: config.m4 322428 2012-01-17 21:42:40Z pdezwart $
dnl config.m4 for extension amqp
dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.
dnl amqp
dnl If your extension references something external, use with:
dnl Make sure that the comment is aligned:
PHP_ARG_WITH(amqp, for amqp support,
-[ --with-amqp Include amqp support])
+[ --with-amqp Include amqp support])
-PHP_ARG_WITH(librabbitmq-dir, for amqp,
-[ --with-librabbitmq-dir[=DIR] Set the path to librabbitmq install prefix.], yes)
+PHP_ARG_WITH(librabbitmq-dir, for amqp,
+[ --with-librabbitmq-dir[=DIR] Set the path to librabbitmq install prefix.], yes)
if test "$PHP_AMQP" != "no"; then
dnl Write more examples of tests here...
AC_MSG_RESULT($PHP_AMQP)
dnl # --with-amqp -> check with-path
SEARCH_FOR="amqp_framing.h"
AC_MSG_CHECKING([for amqp files in default path])
if test "$PHP_LIBRABBITMQ_DIR" != "no" && test "$PHP_LIBRABBITMQ_DIR" != "yes"; then
for i in $PHP_LIBRABBITMQ_DIR; do
if test -r $i/include/$SEARCH_FOR;
then
AMQP_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
else
for i in $PHP_AMQP /usr/local /usr ; do
if test -r $i/include/$SEARCH_FOR;
then
AMQP_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
if test -z "$AMQP_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the librabbitmq distribution itself or (re)install librabbitmq development package if it available in your system])
fi
dnl # --with-amqp -> add include path
-
PHP_ADD_INCLUDE($AMQP_DIR/include)
- dnl # --with-amqp -> check for lib and symbol presence
+ old_CFLAGS=$CFLAGS
+ CFLAGS="-I$AMQP_DIR/include"
+
+ AC_CACHE_CHECK(for librabbitmq version, ac_cv_librabbitmq_version, [
+ AC_TRY_RUN([
+ #include "amqp.h"
+ #include <stdio.h>
+
+ int main ()
+ {
+ FILE *testfile = fopen("conftestval", "w");
+
+ if (NULL == testfile) {
+ return 1;
+ }
+
+ fprintf(testfile, "%s\n", AMQ_VERSION_STRING);
+ fclose(testfile);
+
+ return 0;
+ }
+ ], [ac_cv_librabbitmq_version=`cat ./conftestval`], [ac_cv_librabbitmq_version=NONE], [ac_cv_librabbitmq_version=NONE])
+ ])
+
+ CFLAGS=$old_CFLAGS
+
+ if test "$ac_cv_librabbitmq_version" != "NONE"; then
+ ac_IFS=$IFS
+ IFS=.
+ set $ac_cv_librabbitmq_version
+ IFS=$ac_IFS
+ LIBRABBITMQ_API_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
+
+ if test "$LIBRABBITMQ_API_VERSION" -lt 5001 ; then
+ AC_MSG_ERROR([librabbitmq must be version 0.5.2 or greater, $ac_cv_librabbitmq_version version given instead])
+ fi
+ if test "$LIBRABBITMQ_API_VERSION" -lt 6000 ; then
+ AC_MSG_WARN([librabbitmq 0.6.0 or greater recommended, current version is $ac_cv_librabbitmq_version])
+ fi
+ else
+ AC_MSG_ERROR([could not determine librabbitmq version])
+ fi
+
+ dnl # --with-amqp -> check for lib and symbol presence
LIBNAME=rabbitmq
LIBSYMBOL=rabbitmq
+ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $AMQP_DIR/$PHP_LIBDIR, AMQP_SHARED_LIBADD)
+ PHP_SUBST(AMQP_SHARED_LIBADD)
+
if test -z "$TRAVIS" ; then
type git &>/dev/null
if test $? -eq 0 ; then
git describe --abbrev=0 --tags &>/dev/null
if test $? -eq 0 ; then
AC_DEFINE_UNQUOTED([PHP_AMQP_VERSION], ["`git describe --abbrev=0 --tags`-`git rev-parse --abbrev-ref HEAD`-dev"], [git version])
fi
git rev-parse --short HEAD &>/dev/null
if test $? -eq 0 ; then
AC_DEFINE_UNQUOTED([PHP_AMQP_REVISION], ["`git rev-parse --short HEAD`"], [git revision])
fi
else
AC_MSG_NOTICE([git not installed. Cannot obtain php_amqp version tag. Install git.])
fi
fi
- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $AMQP_DIR/$PHP_LIBDIR, AMQP_SHARED_LIBADD)
- PHP_SUBST(AMQP_SHARED_LIBADD)
-
AMQP_SOURCES="amqp.c amqp_exchange.c amqp_queue.c amqp_connection.c amqp_connection_resource.c amqp_channel.c amqp_envelope.c"
PHP_NEW_EXTENSION(amqp, $AMQP_SOURCES, $ext_shared)
fi
diff --git a/amqp-1.7.0alpha2/config.w32 b/amqp-1.7.0/config.w32
similarity index 66%
rename from amqp-1.7.0alpha2/config.w32
rename to amqp-1.7.0/config.w32
index 99dcab6..514d8c6 100644
--- a/amqp-1.7.0alpha2/config.w32
+++ b/amqp-1.7.0/config.w32
@@ -1,12 +1,12 @@
ARG_WITH("amqp", "AMQP support", "no");
if (PHP_AMQP != "no") {
if (CHECK_HEADER_ADD_INCLUDE("amqp.h", "CFLAGS_AMQP", PHP_PHP_BUILD + "\\include;" + PHP_AMQP) &&
- CHECK_LIB("rabbinmq_a.lib;rabbitmq.lib;rabbitmq.1.lib", "amqp", PHP_PHP_BUILD + "\\lib;" + PHP_AMQP)) {
+ CHECK_LIB("rabbitmq.4.lib", "amqp", PHP_PHP_BUILD + "\\lib;" + PHP_AMQP)) {
// ADD_FLAG("CFLAGS_AMQP", "/D HAVE_AMQP_GETSOCKOPT");
- EXTENSION('amqp', 'amqp.c amqp_exchange.c amqp_queue.c amqp_connection_resource.c amqp_connection.c amqp_channel.c amqp_envelope.c amqp_object_store.c');
+ EXTENSION('amqp', 'amqp.c amqp_exchange.c amqp_queue.c amqp_connection.c amqp_connection_resource.c amqp_channel.c amqp_envelope.c');
AC_DEFINE('HAVE_AMQP', 1);
} else {
WARNING("amqp not enabled; libraries and headers not found");
}
}
diff --git a/amqp-1.7.0alpha2/php5_support.h b/amqp-1.7.0/php5_support.h
similarity index 96%
rename from amqp-1.7.0alpha2/php5_support.h
rename to amqp-1.7.0/php5_support.h
index 5b2f35f..fbd2c5c 100644
--- a/amqp-1.7.0alpha2/php5_support.h
+++ b/amqp-1.7.0/php5_support.h
@@ -1,113 +1,114 @@
/*
+----------------------------------------------------------------------+
| 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_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_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_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, str, len, res) PHP5to7_ZEND_HASH_FIND((ht), (str), (len), (res))
+#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_CONTINUE continue
#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))
#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.7.0alpha2/php7_support.h b/amqp-1.7.0/php7_support.h
similarity index 96%
rename from amqp-1.7.0alpha2/php7_support.h
rename to amqp-1.7.0/php7_support.h
index 34c247d..5fb0151 100644
--- a/amqp-1.7.0alpha2/php7_support.h
+++ b/amqp-1.7.0/php7_support.h
@@ -1,105 +1,106 @@
/*
+----------------------------------------------------------------------+
| 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_INIT(zv)
#define PHP5to7_ARRAY_INIT(zv) array_init(&(zv));
#define PHP5to7_MAYBE_DESTROY(zv) if (!Z_ISUNDEF(zv)) { zval_ptr_dtor(&(zv)); }
#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_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, str, len, res) ((res = zend_hash_str_find_ptr((ht), (key), (size_t)(len))) != NULL)
+#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(return_value) == 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_CONTINUE continue
#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))
#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.7.0alpha2/php_amqp.h b/amqp-1.7.0/php_amqp.h
similarity index 98%
rename from amqp-1.7.0alpha2/php_amqp.h
rename to amqp-1.7.0/php_amqp.h
index 9b759c8..76bf15e 100644
--- a/amqp-1.7.0alpha2/php_amqp.h
+++ b/amqp-1.7.0/php_amqp.h
@@ -1,348 +1,345 @@
/*
+----------------------------------------------------------------------+
| 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 |
+----------------------------------------------------------------------+
*/
/* $Id: php_amqp.h 327551 2012-09-09 03:49:34Z pdezwart $ */
#ifndef PHP_AMQP_H
#define PHP_AMQP_H
#include "amqp.h"
#if PHP_MAJOR_VERSION >= 7
#include "php7_support.h"
#else
#include "php5_support.h"
#endif
extern zend_module_entry amqp_module_entry;
#define phpext_amqp_ptr &amqp_module_entry
#ifdef PHP_WIN32
#define PHP_AMQP_API __declspec(dllexport)
#else
#define PHP_AMQP_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#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"
PHP_MINIT_FUNCTION(amqp);
PHP_MSHUTDOWN_FUNCTION(amqp);
PHP_MINFO_FUNCTION(amqp);
amqp_table_t *convert_zval_to_amqp_table(zval *zvalArguments TSRMLS_DC);
void php_amqp_free_amqp_table(amqp_table_t * table);
char *stringify_bytes(amqp_bytes_t bytes);
/* 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;
typedef struct _amqp_connection_resource amqp_connection_resource;
typedef struct _amqp_connection_object amqp_connection_object;
typedef struct _amqp_channel_resource {
char is_connected;
amqp_channel_t channel_id;
amqp_connection_resource *connection_resource;
} amqp_channel_resource;
/* NOTE: due to how interanlly PHP works with custom object, zend_object position in structure matters */
typedef struct _amqp_channel_object {
#if PHP_MAJOR_VERSION >= 7
amqp_channel_resource *channel_resource;
zend_object zo;
#else
zend_object zo;
amqp_channel_resource *channel_resource;
#endif
} amqp_channel_object;
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;
- char *resource_key;
- PHP5to7_param_str_len_type_t resource_key_len;
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 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(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) (PHP_AMQP_GET_CHANNEL(obj))->channel_resource
-
+#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_ERROR_MESSAGE_PTR &php_amqp_internal_error_message
#define PHP_AMQP_ERROR_MESSAGE php_amqp_internal_error_message
#define PHP_AMQP_INIT_ERROR_MESSAGE()\
char *PHP_AMQP_ERROR_MESSAGE = NULL;
#define PHP_AMQP_DESTROY_ERROR_MESSAGE()\
if (PHP_AMQP_ERROR_MESSAGE != NULL) { efree(PHP_AMQP_ERROR_MESSAGE); }
#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
#ifdef ZTS
#define AMQP_G(v) TSRMG(amqp_globals_id, zend_amqp_globals *, v)
#else
#define AMQP_G(v) (amqp_globals.v)
#endif
#ifndef PHP_AMQP_VERSION
-#define PHP_AMQP_VERSION "1.7.0alpha2"
+#define PHP_AMQP_VERSION "1.7.0"
#endif
#ifndef PHP_AMQP_REVISION
#define PHP_AMQP_REVISION "release"
#endif
void php_amqp_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource TSRMLS_DC);
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_maybe_release_buffers_on_channel(amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource);
amqp_bytes_t php_amqp_long_string(char const *cstr, PHP5to7_param_str_len_type_t len);
#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.7.0alpha2/stubs/AMQP.php b/amqp-1.7.0/stubs/AMQP.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQP.php
rename to amqp-1.7.0/stubs/AMQP.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPChannel.php b/amqp-1.7.0/stubs/AMQPChannel.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPChannel.php
rename to amqp-1.7.0/stubs/AMQPChannel.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPChannelException.php b/amqp-1.7.0/stubs/AMQPChannelException.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPChannelException.php
rename to amqp-1.7.0/stubs/AMQPChannelException.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPConnection.php b/amqp-1.7.0/stubs/AMQPConnection.php
similarity index 91%
rename from amqp-1.7.0alpha2/stubs/AMQPConnection.php
rename to amqp-1.7.0/stubs/AMQPConnection.php
index df064c3..46c75e4 100644
--- a/amqp-1.7.0alpha2/stubs/AMQPConnection.php
+++ b/amqp-1.7.0/stubs/AMQPConnection.php
@@ -1,347 +1,358 @@
<?php
/**
* stub class representing AMQPConnection from pecl-amqp
*/
class AMQPConnection
{
/**
* Establish a transient connection with the AMQP broker.
*
* This method will initiate a connection with the AMQP broker.
*
* @throws AMQPConnectionException
* @return boolean TRUE on success or throw an exception on failure.
*/
public function connect()
{
}
/**
* Create an instance of AMQPConnection.
*
* Creates an AMQPConnection instance representing a connection to an AMQP
* broker. A connection will not be established until
* AMQPConnection::connect() is called.
*
* $credentials = array(
* 'host' => amqp.host The host to connect too. Note: Max 1024 characters.
* 'port' => amqp.port Port on the host.
* 'vhost' => amqp.vhost The virtual host on the host. Note: Max 128 characters.
* 'login' => amqp.login The login name to use. Note: Max 128 characters.
* 'password' => amqp.password Password. Note: Max 128 characters.
* 'read_timeout' => Timeout in for income activity. Note: 0 or greater seconds. May be fractional.
* 'write_timeout' => Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional.
* 'connect_timeout' => Connection timeout. Note: 0 or greater seconds. May be fractional.
*
* Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details):
* 'channel_max' => Specifies highest channel number that the server permits. 0 means standard extension limit
* (see PHP_AMQP_MAX_CHANNELS constant)
* 'frame_max' => The largest frame size that the server proposes for the connection, including frame header
* and end-byte. 0 means standard extension limit (depends on librabbimq default frame size limit)
* 'heartbeat' => The delay, in seconds, of the connection heartbeat that the server wants.
* 0 means the server does not want a heartbeat. Note, librabbitmq has limited heartbeat support,
* which means heartbeats checked only during blocking calls.
* )
*
* @param array $credentials Optional array of credential information for
* connecting to the AMQP broker.
*/
public function __construct(array $credentials = array())
{
}
/**
* Closes the transient connection with the AMQP broker.
*
* This method will close an open connection with the AMQP broker.
*
* @return boolean true if connection was successfully closed, false otherwise.
*/
public function disconnect()
{
}
/**
* Get the configured host.
*
* @return string The configured hostname of the broker
*/
public function getHost()
{
}
/**
* Get the configured login.
*
* @return string The configured login as a string.
*/
public function getLogin()
{
}
/**
* Get the configured password.
*
* @return string The configured password as a string.
*/
public function getPassword()
{
}
/**
* Get the configured port.
*
* @return int The configured port as an integer.
*/
public function getPort()
{
}
/**
* Get the configured vhost.
*
* @return string The configured virtual host as a string.
*/
public function getVhost()
{
}
/**
* Check whether the connection to the AMQP broker is still valid.
*
* It does so by checking the return status of the last connect-command.
*
* @return boolean True if connected, false otherwise.
*/
public function isConnected()
{
}
/**
* Establish a persistent connection with the AMQP broker.
*
* This method will initiate a connection with the AMQP broker
* or reuse an existing one if present.
*
* @throws AMQPConnectionException
* @return boolean TRUE on success or throws an exception on failure.
*/
public function pconnect()
{
}
/**
* Closes a persistent connection with the AMQP broker.
*
* This method will close an open persistent connection with the AMQP
* broker.
*
* @return boolean true if connection was found and closed,
* false if no persistent connection with this host,
* port, vhost and login could be found,
*/
public function pdisconnect()
{
}
/**
* Close any open transient connections and initiate a new one with the AMQP broker.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function reconnect()
{
}
/**
* Close any open persistent connections and initiate a new one with the AMQP broker.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function preconnect()
{
}
/**
* Set the hostname used to connect to the AMQP broker.
*
* @param string $host The hostname of the AMQP broker.
*
* @throws AMQPConnectionException If host is longer then 1024 characters.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setHost($host)
{
}
/**
* Set the login string used to connect to the AMQP broker.
*
* @param string $login The login string used to authenticate
* with the AMQP broker.
*
* @throws AMQPConnectionException If login is longer then 32 characters.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setLogin($login)
{
}
/**
* Set the password string used to connect to the AMQP broker.
*
* @param string $password The password string used to authenticate
* with the AMQP broker.
*
* @throws AMQPConnectionException If password is longer then 32characters.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setPassword($password)
{
}
/**
* Set the port used to connect to the AMQP broker.
*
* @param integer $port The port used to connect to the AMQP broker.
*
* @throws AMQPConnectionException If port is longer not between
* 1 and 65535.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setPort($port)
{
}
/**
* Sets the virtual host to which to connect on the AMQP broker.
*
* @param string $vhost The virtual host to use on the AMQP
* broker.
*
* @throws AMQPConnectionException If host is longer then 32 characters.
*
* @return boolean true on success or false on failure.
*/
public function setVhost($vhost)
{
}
/**
* Sets the interval of time to wait for income activity from AMQP broker
*
* @deprecated use AMQPConnection::setReadTimout($timeout) instead
*
* @param int $timeout
*
* @return bool
*/
public function setTimeout($timeout)
{
}
/**
* Get the configured interval of time to wait for income activity
* from AMQP broker
*
* @deprecated use AMQPConnection::getReadTimout() instead
*
* @return float
*/
public function getTimeout()
{
}
/**
* Sets the interval of time to wait for income activity from AMQP broker
*
* @param int $timeout
*
* @return bool
*/
public function setReadTimeout($timeout)
{
}
/**
* Get the configured interval of time to wait for income activity
* from AMQP broker
*
* @return float
*/
public function getReadTimeout()
{
}
/**
* Sets the interval of time to wait for outcome activity to AMQP broker
*
* @param int $timeout
*
* @return bool
*/
public function setWriteTimeout($timeout)
{
}
/**
* Get the configured interval of time to wait for outcome activity
* to AMQP broker
*
* @return float
*/
public function getWriteTimeout()
{
}
/**
* Return last used channel id during current connection session.
*
* @return int
*/
public function getUsedChannels()
{
}
/**
* Get the maximum number of channels the connection can handle.
*
- * @return int|null
+ * When connection is connected, effective connection value returned, which is normally the same as original
+ * correspondent value passed to constructor, otherwise original value passed to constructor returned.
+ *
+ * @return int
*/
public function getMaxChannels()
{
}
/**
* Get max supported frame size per connection in bytes.
*
- * @return int|null
+ * When connection is connected, effective connection value returned, which is normally the same as original
+ * correspondent value passed to constructor, otherwise original value passed to constructor returned.
+ *
+ * @return int
*/
public function getMaxFrameSize()
{
}
/**
* Get number of seconds between heartbeats of the connection in seconds.
*
- * @return int|null
+ * When connection is connected, effective connection value returned, which is normally the same as original
+ * correspondent value passed to constructor, otherwise original value passed to constructor returned.
+ *
+ * @return int
*/
public function getHeartbeatInterval()
{
}
/**
* Whether connection persistent.
*
- * @return bool|null
+ * When connection is not connected, boolean false always returned
+ *
+ * @return bool
*/
public function isPersistent()
{
}
}
diff --git a/amqp-1.7.0alpha2/stubs/AMQPConnectionException.php b/amqp-1.7.0/stubs/AMQPConnectionException.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPConnectionException.php
rename to amqp-1.7.0/stubs/AMQPConnectionException.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPEnvelope.php b/amqp-1.7.0/stubs/AMQPEnvelope.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPEnvelope.php
rename to amqp-1.7.0/stubs/AMQPEnvelope.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPException.php b/amqp-1.7.0/stubs/AMQPException.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPException.php
rename to amqp-1.7.0/stubs/AMQPException.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPExchange.php b/amqp-1.7.0/stubs/AMQPExchange.php
similarity index 97%
rename from amqp-1.7.0alpha2/stubs/AMQPExchange.php
rename to amqp-1.7.0/stubs/AMQPExchange.php
index b24e2b8..1f6355c 100644
--- a/amqp-1.7.0alpha2/stubs/AMQPExchange.php
+++ b/amqp-1.7.0/stubs/AMQPExchange.php
@@ -1,262 +1,262 @@
<?php
/**
* stub class representing AMQPExchange from pecl-amqp
*/
class AMQPExchange
{
/**
* Bind to another exchange.
*
* Bind an exchange to another exchange using the specified routing key.
*
* @param string $exchange_name Name of the exchange to bind.
* @param string $routing_key The routing key to use for binding.
* @param array $arguments Additional binding arguments.
*
* @throws AMQPExchangeException On failure.
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @return boolean true on success or false on failure.
*/
public function bind($exchange_name, $routing_key = '', array $arguments = array())
{
}
/**
* Remove binding to another exchange.
*
* Remove a routing key binding on an another exchange from the given exchange.
*
* @param string $exchange_name Name of the exchange to bind.
* @param string $routing_key The routing key to use for binding.
* @param array $arguments Additional binding arguments.
*
* @throws AMQPExchangeException On failure.
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
* @return boolean true on success or false on failure.
*/
public function unbind($exchange_name, $routing_key = '', array $arguments = array())
{
}
/**
* Create an instance of AMQPExchange.
*
* Returns a new instance of an AMQPExchange object, associated with the
* given AMQPChannel object.
*
* @param AMQPChannel $amqp_channel A valid AMQPChannel object, connected
* to a broker.
*
* @throws AMQPExchangeException 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)
{
}
/**
* Declare a new exchange on the broker.
*
* @throws AMQPExchangeException On failure.
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function declareExchange()
{
}
/**
* Delete the exchange from the broker.
*
* @param string $exchangeName Optional name of exchange to delete.
* @param integer $flags Optionally AMQP_IFUNUSED can be specified
* to indicate the exchange should not be
* deleted until no clients are connected to
* it.
*
* @throws AMQPExchangeException On failure.
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean true on success or false on failure.
*/
public function delete($exchangeName = null, $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)
{
}
/**
* Check whether argument associated with the given key exists.
*
* @param string $key The key to look up.
*
* @return bool
*/
public function hasArgument($key)
{
}
/**
* Get all arguments set on the given exchange.
*
* @return array An array containing all of the set key/value pairs.
*/
public function getArguments()
{
}
/**
* Get all the flags currently set on the given exchange.
*
* @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()
{
}
/**
* Get the configured type.
*
* @return string The configured type as a string.
*/
public function getType()
{
}
/**
* Publish a message to an exchange.
*
* Publish a message to the exchange represented by the AMQPExchange object.
*
* @param string $message The message to publish.
* @param string $routing_key The optional routing key to which to
* publish to.
* @param integer $flags One or more of AMQP_MANDATORY and
* AMQP_IMMEDIATE.
* @param array $attributes One of content_type, content_encoding,
* message_id, user_id, app_id, delivery_mode,
* priority, timestamp, expiration, type
* or reply_to, headers.
*
* @throws AMQPExchangeException On failure.
* @throws AMQPChannelException If the channel is not open.
* @throws AMQPConnectionException If the connection to the broker was lost.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function publish(
$message,
$routing_key = null,
$flags = AMQP_NOPARAM,
array $attributes = array()
) {
}
/**
* Set the value for the given key.
*
* @param string $key Name of the argument to set.
* @param string|integer $value Value of the argument to set.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setArgument($key, $value)
{
}
/**
* Set all arguments on the exchange.
*
* @param array $arguments An array of key/value pairs of arguments.
*
* @return boolean TRUE on success or FALSE on failure.
*/
public function setArguments(array $arguments)
{
}
/**
* Set the flags on an exchange.
*
* @param integer $flags A bitmask of flags. This call currently only
* considers the following flags:
* AMQP_DURABLE, AMQP_PASSIVE
* (and AMQP_DURABLE, if librabbitmq version >= 0.5.3)
*
- * @return boolean True on success or false on failure.
+ * @return void
*/
public function setFlags($flags)
{
}
/**
* Set the name of the exchange.
*
* @param string $exchange_name The name of the exchange to set as string.
*
- * @return boolean TRUE on success or FALSE on failure.
+ * @return void
*/
public function setName($exchange_name)
{
}
/**
* Set the type of the exchange.
*
* Set the type of the exchange. This can be any of AMQP_EX_TYPE_DIRECT,
* AMQP_EX_TYPE_FANOUT, AMQP_EX_TYPE_HEADERS or AMQP_EX_TYPE_TOPIC.
*
* @param string $exchange_type The type of exchange as a string.
*
- * @return boolean TRUE on success or FALSE on failure.
+ * @return void
*/
public function setType($exchange_type)
{
}
/**
* Get the AMQPChannel object in use
*
* @return AMQPChannel
*/
public function getChannel()
{
}
/**
* Get the AMQPConnection object in use
*
* @return AMQPConnection
*/
public function getConnection()
{
}
}
diff --git a/amqp-1.7.0alpha2/stubs/AMQPExchangeException.php b/amqp-1.7.0/stubs/AMQPExchangeException.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPExchangeException.php
rename to amqp-1.7.0/stubs/AMQPExchangeException.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPQueue.php b/amqp-1.7.0/stubs/AMQPQueue.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPQueue.php
rename to amqp-1.7.0/stubs/AMQPQueue.php
diff --git a/amqp-1.7.0alpha2/stubs/AMQPQueueException.php b/amqp-1.7.0/stubs/AMQPQueueException.php
similarity index 100%
rename from amqp-1.7.0alpha2/stubs/AMQPQueueException.php
rename to amqp-1.7.0/stubs/AMQPQueueException.php
diff --git a/amqp-1.7.0alpha2/tests/_test_helpers.php.inc b/amqp-1.7.0/tests/_test_helpers.php.inc
similarity index 100%
rename from amqp-1.7.0alpha2/tests/_test_helpers.php.inc
rename to amqp-1.7.0/tests/_test_helpers.php.inc
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_basicRecover.phpt b/amqp-1.7.0/tests/amqpchannel_basicRecover.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpchannel_basicRecover.phpt
rename to amqp-1.7.0/tests/amqpchannel_basicRecover.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_construct_basic.phpt b/amqp-1.7.0/tests/amqpchannel_construct_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpchannel_construct_basic.phpt
rename to amqp-1.7.0/tests/amqpchannel_construct_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_getChannelId.phpt b/amqp-1.7.0/tests/amqpchannel_getChannelId.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpchannel_getChannelId.phpt
rename to amqp-1.7.0/tests/amqpchannel_getChannelId.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_get_connection.phpt b/amqp-1.7.0/tests/amqpchannel_get_connection.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpchannel_get_connection.phpt
rename to amqp-1.7.0/tests/amqpchannel_get_connection.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_multi_channel_connection.phpt b/amqp-1.7.0/tests/amqpchannel_multi_channel_connection.phpt
similarity index 87%
rename from amqp-1.7.0alpha2/tests/amqpchannel_multi_channel_connection.phpt
rename to amqp-1.7.0/tests/amqpchannel_multi_channel_connection.phpt
index 47e9e3d..dfc1323 100644
--- a/amqp-1.7.0alpha2/tests/amqpchannel_multi_channel_connection.phpt
+++ b/amqp-1.7.0/tests/amqpchannel_multi_channel_connection.phpt
@@ -1,27 +1,27 @@
--TEST--
-Multiple AMQPChannels per AMQPConnection
+AMQPConnection - multiple AMQPChannels per AMQPConnection
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
echo get_class($ch) . "\n";
echo $ch->isConnected() ? 'true' : 'false';
echo "\n";
$ch2 = new AMQPChannel($cnn);
echo get_class($ch) . "\n";
echo $ch->isConnected() ? 'true' : 'false';
unset($ch2);
$ch->setPrefetchCount(10);
?>
--EXPECT--
AMQPChannel
true
AMQPChannel
-true
\ No newline at end of file
+true
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_slots_usage.phpt b/amqp-1.7.0/tests/amqpchannel_slots_usage.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpchannel_slots_usage.phpt
rename to amqp-1.7.0/tests/amqpchannel_slots_usage.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpchannel_var_dump.phpt b/amqp-1.7.0/tests/amqpchannel_var_dump.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpchannel_var_dump.phpt
rename to amqp-1.7.0/tests/amqpchannel_var_dump.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_connect_login_failure.phpt b/amqp-1.7.0/tests/amqpconnection_connect_login_failure.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_connect_login_failure.phpt
rename to amqp-1.7.0/tests/amqpconnection_connect_login_failure.phpt
diff --git a/amqp-1.7.0/tests/amqpconnection_connection_getters.phpt b/amqp-1.7.0/tests/amqpconnection_connection_getters.phpt
new file mode 100644
index 0000000..e92bc6f
--- /dev/null
+++ b/amqp-1.7.0/tests/amqpconnection_connection_getters.phpt
@@ -0,0 +1,89 @@
+--TEST--
+AMQPConnection - connection-specific getters
+--SKIPIF--
+<?php
+if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
+ print "skip";
+}
+?>
+--FILE--
+<?php
+$cnn = new AMQPConnection();
+
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
+echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn->connect();
+
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
+echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn->disconnect();
+
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
+echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo PHP_EOL;
+
+
+$cnn = new AMQPConnection(array('channel_max' => '10', 'frame_max' => 10240, 'heartbeat' => 10));
+
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
+echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn->connect();
+
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
+echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn->disconnect();
+
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'channel_max: ', var_export($cnn->getMaxChannels(), true), PHP_EOL;
+echo 'frame_max: ', var_export($cnn->getMaxFrameSize(), true), PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo PHP_EOL;
+?>
+--EXPECT--
+connected: false
+channel_max: 256
+frame_max: 131072
+heartbeat: 0
+
+connected: true
+channel_max: 256
+frame_max: 131072
+heartbeat: 0
+
+connected: false
+channel_max: 256
+frame_max: 131072
+heartbeat: 0
+
+connected: false
+channel_max: 10
+frame_max: 10240
+heartbeat: 10
+
+connected: true
+channel_max: 10
+frame_max: 10240
+heartbeat: 10
+
+connected: false
+channel_max: 10
+frame_max: 10240
+heartbeat: 10
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_basic.phpt b/amqp-1.7.0/tests/amqpconnection_construct_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_basic.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_read_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_ini_read_timeout.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_read_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_ini_read_timeout.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_ini_timeout.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_ini_timeout.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_ini_timeout_and_read_timeout.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_timeout_default.phpt b/amqp-1.7.0/tests/amqpconnection_construct_ini_timeout_default.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_ini_timeout_default.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_ini_timeout_default.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_connect_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_with_connect_timeout.phpt
similarity index 94%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_with_connect_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_with_connect_timeout.phpt
index 8a55349..b89339d 100644
--- a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_connect_timeout.phpt
+++ b/amqp-1.7.0/tests/amqpconnection_construct_with_connect_timeout.phpt
@@ -1,43 +1,43 @@
--TEST--
-AMQPConnection constructor with timeout parameter in creadentials
+AMQPConnection constructor with timeout parameter in credentials
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
try {
$cnn = new AMQPConnection(array('connect_timeout' => -1.5));
} catch (AMQPConnectionException $e) {
echo $e->getMessage(), PHP_EOL;
}
$timeout = 10.5;
// resolve hostname to don't waste time on resolve inside library while resolve operations are not under timings limit (yet)
$credentials = array('host' => gethostbyname('google.com'), 'connect_timeout' => $timeout);
//$credentials = array('host' => 'google.com', 'connect_timeout' => $timeout);
$cnn = new AMQPConnection($credentials);
$start = microtime(true);
try {
$cnn->connect();
} catch (AMQPConnectionException $e) {
echo $e->getMessage(), PHP_EOL;
$end = microtime(true);
$error = $end - $start - $timeout;
$limit = abs(log10($timeout)); // empirical value
echo 'error: ', $error, PHP_EOL;
echo 'limit: ', $limit, PHP_EOL;
echo abs($error) <= $limit ? 'timings OK' : 'timings failed'; // error should be less than 5% of timeout value
}
?>
--EXPECTF--
Parameter 'connect_timeout' must be greater than or equal to zero.
Socket error: could not connect to host.
error: %f
limit: %f
timings OK
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_limits.phpt b/amqp-1.7.0/tests/amqpconnection_construct_with_limits.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_with_limits.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_with_limits.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_with_timeout.phpt
similarity index 84%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_with_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_with_timeout.phpt
index 2b0673b..eba2397 100644
--- a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_timeout.phpt
+++ b/amqp-1.7.0/tests/amqpconnection_construct_with_timeout.phpt
@@ -1,13 +1,13 @@
--TEST--
-AMQPConnection constructor with timeout parameter in creadentials
+AMQPConnection constructor with timeout parameter in credentials
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$credentials = array('timeout' => 101.101);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
%s: AMQPConnection::__construct(): Parameter 'timeout' is deprecated; use 'read_timeout' instead in %s on line 3
float(101.101)
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
similarity index 94%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
index 1e95ea2..2f7eca1 100644
--- a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
+++ b/amqp-1.7.0/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt
@@ -1,13 +1,13 @@
--TEST--
-AMQPConnection constructor with both timeout and read_timeout parameters in creadentials
+AMQPConnection constructor with both timeout and read_timeout parameters in credentials
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$credentials = array('timeout' => 101.101, 'read_timeout' => 202.202);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
Notice: AMQPConnection::__construct(): Parameter 'timeout' is deprecated, 'read_timeout' used instead in %s on line 3
float(202.202)
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_construct_with_write_timeout.phpt b/amqp-1.7.0/tests/amqpconnection_construct_with_write_timeout.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_construct_with_write_timeout.phpt
rename to amqp-1.7.0/tests/amqpconnection_construct_with_write_timeout.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_getUsedChannels.phpt b/amqp-1.7.0/tests/amqpconnection_getUsedChannels.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_getUsedChannels.phpt
rename to amqp-1.7.0/tests/amqpconnection_getUsedChannels.phpt
diff --git a/amqp-1.7.0/tests/amqpconnection_heartbeat.phpt b/amqp-1.7.0/tests/amqpconnection_heartbeat.phpt
new file mode 100644
index 0000000..a86bcbb
--- /dev/null
+++ b/amqp-1.7.0/tests/amqpconnection_heartbeat.phpt
@@ -0,0 +1,37 @@
+--TEST--
+AMQPConnection - heartbeats support
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) print "skip"; ?>
+--FILE--
+<?php
+$heartbeat = 2;
+$credentials = array('heartbeat' => $heartbeat);
+$cnn = new AMQPConnection($credentials);
+$cnn->connect();
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+
+sleep($heartbeat*5);
+
+try {
+ $ch = new AMQPChannel($cnn);
+ echo 'channel created', PHP_EOL;
+} catch (AMQPException $e) {
+ echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+}
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+
+?>
+--EXPECTF--
+heartbeat: 2
+connected: true
+persistent: false
+AMQPException: Library error: a socket error occurred
+heartbeat: 2
+connected: false
+persistent: false
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_heartbeat_with_consumer.phpt b/amqp-1.7.0/tests/amqpconnection_heartbeat_with_consumer.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_heartbeat_with_consumer.phpt
rename to amqp-1.7.0/tests/amqpconnection_heartbeat_with_consumer.phpt
diff --git a/amqp-1.7.0/tests/amqpconnection_heartbeat_with_persistent.phpt b/amqp-1.7.0/tests/amqpconnection_heartbeat_with_persistent.phpt
new file mode 100644
index 0000000..37e4f8d
--- /dev/null
+++ b/amqp-1.7.0/tests/amqpconnection_heartbeat_with_persistent.phpt
@@ -0,0 +1,92 @@
+--TEST--
+AMQPConnection - heartbeats support with persistent connections
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) print "skip"; ?>
+--FILE--
+<?php
+$heartbeat = 2;
+$credentials = array('heartbeat' => $heartbeat);
+
+$cnn = new AMQPConnection($credentials);
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn->pconnect();
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+echo PHP_EOL;
+
+sleep($heartbeat*5);
+
+try {
+ $ch = new AMQPChannel($cnn);
+ echo 'channel created', PHP_EOL;
+} catch (AMQPException $e) {
+ echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+}
+
+echo PHP_EOL;
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn = new AMQPConnection($credentials);
+$cnn->pconnect();
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+echo PHP_EOL;
+
+
+$ch = new AMQPChannel($cnn);
+echo 'channel created', PHP_EOL;
+echo PHP_EOL;
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+echo PHP_EOL;
+
+$cnn->pdisconnect();
+
+echo 'heartbeat: ', var_export($cnn->getHeartbeatInterval(), true), PHP_EOL;
+echo 'connected: ', var_export($cnn->isConnected(), true), PHP_EOL;
+echo 'persistent: ', var_export($cnn->isPersistent(), true), PHP_EOL;
+echo PHP_EOL;
+
+?>
+--EXPECTF--
+heartbeat: 2
+connected: false
+persistent: false
+
+heartbeat: 2
+connected: true
+persistent: true
+
+AMQPException: Library error: a socket error occurred
+
+heartbeat: 2
+connected: false
+persistent: false
+
+heartbeat: 2
+connected: true
+persistent: true
+
+channel created
+
+heartbeat: 2
+connected: true
+persistent: true
+
+heartbeat: 2
+connected: false
+persistent: false
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_persistent_construct_basic.phpt b/amqp-1.7.0/tests/amqpconnection_persistent_construct_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_persistent_construct_basic.phpt
rename to amqp-1.7.0/tests/amqpconnection_persistent_construct_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_persistent_in_use.phpt b/amqp-1.7.0/tests/amqpconnection_persistent_in_use.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_persistent_in_use.phpt
rename to amqp-1.7.0/tests/amqpconnection_persistent_in_use.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_persistent_reusable.phpt b/amqp-1.7.0/tests/amqpconnection_persistent_reusable.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_persistent_reusable.phpt
rename to amqp-1.7.0/tests/amqpconnection_persistent_reusable.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setHost.phpt b/amqp-1.7.0/tests/amqpconnection_setHost.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setHost.phpt
rename to amqp-1.7.0/tests/amqpconnection_setHost.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setLogin.phpt b/amqp-1.7.0/tests/amqpconnection_setLogin.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setLogin.phpt
rename to amqp-1.7.0/tests/amqpconnection_setLogin.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setPassword.phpt b/amqp-1.7.0/tests/amqpconnection_setPassword.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setPassword.phpt
rename to amqp-1.7.0/tests/amqpconnection_setPassword.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setPort_int.phpt b/amqp-1.7.0/tests/amqpconnection_setPort_int.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setPort_int.phpt
rename to amqp-1.7.0/tests/amqpconnection_setPort_int.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setPort_out_of_range.phpt b/amqp-1.7.0/tests/amqpconnection_setPort_out_of_range.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setPort_out_of_range.phpt
rename to amqp-1.7.0/tests/amqpconnection_setPort_out_of_range.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setPort_string.phpt b/amqp-1.7.0/tests/amqpconnection_setPort_string.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setPort_string.phpt
rename to amqp-1.7.0/tests/amqpconnection_setPort_string.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_float.phpt b/amqp-1.7.0/tests/amqpconnection_setReadTimeout_float.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_float.phpt
rename to amqp-1.7.0/tests/amqpconnection_setReadTimeout_float.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_int.phpt b/amqp-1.7.0/tests/amqpconnection_setReadTimeout_int.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_int.phpt
rename to amqp-1.7.0/tests/amqpconnection_setReadTimeout_int.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_out_of_range.phpt b/amqp-1.7.0/tests/amqpconnection_setReadTimeout_out_of_range.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_out_of_range.phpt
rename to amqp-1.7.0/tests/amqpconnection_setReadTimeout_out_of_range.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_string.phpt b/amqp-1.7.0/tests/amqpconnection_setReadTimeout_string.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setReadTimeout_string.phpt
rename to amqp-1.7.0/tests/amqpconnection_setReadTimeout_string.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_deprecated.phpt b/amqp-1.7.0/tests/amqpconnection_setTimeout_deprecated.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_deprecated.phpt
rename to amqp-1.7.0/tests/amqpconnection_setTimeout_deprecated.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_float.phpt b/amqp-1.7.0/tests/amqpconnection_setTimeout_float.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_float.phpt
rename to amqp-1.7.0/tests/amqpconnection_setTimeout_float.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_int.phpt b/amqp-1.7.0/tests/amqpconnection_setTimeout_int.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_int.phpt
rename to amqp-1.7.0/tests/amqpconnection_setTimeout_int.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_out_of_range.phpt b/amqp-1.7.0/tests/amqpconnection_setTimeout_out_of_range.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_out_of_range.phpt
rename to amqp-1.7.0/tests/amqpconnection_setTimeout_out_of_range.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_string.phpt b/amqp-1.7.0/tests/amqpconnection_setTimeout_string.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setTimeout_string.phpt
rename to amqp-1.7.0/tests/amqpconnection_setTimeout_string.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setVhost.phpt b/amqp-1.7.0/tests/amqpconnection_setVhost.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setVhost.phpt
rename to amqp-1.7.0/tests/amqpconnection_setVhost.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_float.phpt b/amqp-1.7.0/tests/amqpconnection_setWriteTimeout_float.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_float.phpt
rename to amqp-1.7.0/tests/amqpconnection_setWriteTimeout_float.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_int.phpt b/amqp-1.7.0/tests/amqpconnection_setWriteTimeout_int.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_int.phpt
rename to amqp-1.7.0/tests/amqpconnection_setWriteTimeout_int.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_out_of_range.phpt b/amqp-1.7.0/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
rename to amqp-1.7.0/tests/amqpconnection_setWriteTimeout_out_of_range.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_string.phpt b/amqp-1.7.0/tests/amqpconnection_setWriteTimeout_string.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_setWriteTimeout_string.phpt
rename to amqp-1.7.0/tests/amqpconnection_setWriteTimeout_string.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_toomanychannels.phpt b/amqp-1.7.0/tests/amqpconnection_toomanychannels.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_toomanychannels.phpt
rename to amqp-1.7.0/tests/amqpconnection_toomanychannels.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_var_dump.phpt b/amqp-1.7.0/tests/amqpconnection_var_dump.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpconnection_var_dump.phpt
rename to amqp-1.7.0/tests/amqpconnection_var_dump.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpenvelope_construct.phpt b/amqp-1.7.0/tests/amqpenvelope_construct.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpenvelope_construct.phpt
rename to amqp-1.7.0/tests/amqpenvelope_construct.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpenvelope_get_accessors.phpt b/amqp-1.7.0/tests/amqpenvelope_get_accessors.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpenvelope_get_accessors.phpt
rename to amqp-1.7.0/tests/amqpenvelope_get_accessors.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpenvelope_var_dump.phpt b/amqp-1.7.0/tests/amqpenvelope_var_dump.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpenvelope_var_dump.phpt
rename to amqp-1.7.0/tests/amqpenvelope_var_dump.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_attributes.phpt b/amqp-1.7.0/tests/amqpexchange_attributes.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_attributes.phpt
rename to amqp-1.7.0/tests/amqpexchange_attributes.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_bind.phpt b/amqp-1.7.0/tests/amqpexchange_bind.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_bind.phpt
rename to amqp-1.7.0/tests/amqpexchange_bind.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_bind_with_arguments.phpt b/amqp-1.7.0/tests/amqpexchange_bind_with_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_bind_with_arguments.phpt
rename to amqp-1.7.0/tests/amqpexchange_bind_with_arguments.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_bind_without_key.phpt b/amqp-1.7.0/tests/amqpexchange_bind_without_key.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_bind_without_key.phpt
rename to amqp-1.7.0/tests/amqpexchange_bind_without_key.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_bind_without_key_with_arguments.phpt b/amqp-1.7.0/tests/amqpexchange_bind_without_key_with_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_bind_without_key_with_arguments.phpt
rename to amqp-1.7.0/tests/amqpexchange_bind_without_key_with_arguments.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_channel_refcount.phpt b/amqp-1.7.0/tests/amqpexchange_channel_refcount.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_channel_refcount.phpt
rename to amqp-1.7.0/tests/amqpexchange_channel_refcount.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_construct_basic.phpt b/amqp-1.7.0/tests/amqpexchange_construct_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_construct_basic.phpt
rename to amqp-1.7.0/tests/amqpexchange_construct_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_declare_basic.phpt b/amqp-1.7.0/tests/amqpexchange_declare_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_declare_basic.phpt
rename to amqp-1.7.0/tests/amqpexchange_declare_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_declare_existent.phpt b/amqp-1.7.0/tests/amqpexchange_declare_existent.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_declare_existent.phpt
rename to amqp-1.7.0/tests/amqpexchange_declare_existent.phpt
diff --git a/amqp-1.7.0/tests/amqpexchange_declare_with_stalled_reference.phpt b/amqp-1.7.0/tests/amqpexchange_declare_with_stalled_reference.phpt
new file mode 100644
index 0000000..1215326
--- /dev/null
+++ b/amqp-1.7.0/tests/amqpexchange_declare_with_stalled_reference.phpt
@@ -0,0 +1,40 @@
+--TEST--
+AMQPExchange - declare with stalled reference
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) print "skip"; ?>
+--FILE--
+<?php
+class ConnectionMock extends AMQPConnection {
+ public function __construct(array $credentials = array())
+ {
+ }
+}
+
+class ChannelMock extends AMQPChannel {
+ public function __construct(AMQPConnection $amqp_connection)
+ {
+ }
+}
+
+class ExchangeMock extends \AMQPExchange
+{
+ public function __construct(AMQPChannel $amqp_channel)
+ {
+ }
+}
+
+$cnn = new ConnectionMock();
+$ch = new ChannelMock($cnn);
+
+$e = new ExchangeMock($ch);
+
+
+try {
+ $e->declareExchange();
+} catch (\Exception $e) {
+ echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+}
+
+?>
+--EXPECT--
+AMQPChannelException: Could not declare exchange. Stale reference to the channel object.
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_declare_without_name.phpt b/amqp-1.7.0/tests/amqpexchange_declare_without_name.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_declare_without_name.phpt
rename to amqp-1.7.0/tests/amqpexchange_declare_without_name.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_declare_without_type.phpt b/amqp-1.7.0/tests/amqpexchange_declare_without_type.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_declare_without_type.phpt
rename to amqp-1.7.0/tests/amqpexchange_declare_without_type.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_get_channel.phpt b/amqp-1.7.0/tests/amqpexchange_get_channel.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_get_channel.phpt
rename to amqp-1.7.0/tests/amqpexchange_get_channel.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_get_connection.phpt b/amqp-1.7.0/tests/amqpexchange_get_connection.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_get_connection.phpt
rename to amqp-1.7.0/tests/amqpexchange_get_connection.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_invalid_type.phpt b/amqp-1.7.0/tests/amqpexchange_invalid_type.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_invalid_type.phpt
rename to amqp-1.7.0/tests/amqpexchange_invalid_type.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_basic.phpt b/amqp-1.7.0/tests/amqpexchange_publish_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_basic.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_empty_routing_key.phpt b/amqp-1.7.0/tests/amqpexchange_publish_empty_routing_key.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_empty_routing_key.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_empty_routing_key.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_timeout.disabled b/amqp-1.7.0/tests/amqpexchange_publish_timeout.disabled
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_timeout.disabled
rename to amqp-1.7.0/tests/amqpexchange_publish_timeout.disabled
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_with_null.phpt b/amqp-1.7.0/tests/amqpexchange_publish_with_null.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_with_null.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_with_null.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties.phpt b/amqp-1.7.0/tests/amqpexchange_publish_with_properties.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_with_properties.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt b/amqp-1.7.0/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_with_properties_ignore_num_header.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt b/amqp-1.7.0/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_with_properties_ignore_unsupported_header_values.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_nested_header.phpt b/amqp-1.7.0/tests/amqpexchange_publish_with_properties_nested_header.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_nested_header.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_with_properties_nested_header.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_user_id_failure.phpt b/amqp-1.7.0/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
rename to amqp-1.7.0/tests/amqpexchange_publish_with_properties_user_id_failure.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_setArgument.phpt b/amqp-1.7.0/tests/amqpexchange_setArgument.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_setArgument.phpt
rename to amqp-1.7.0/tests/amqpexchange_setArgument.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_set_flag.phpt b/amqp-1.7.0/tests/amqpexchange_set_flag.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_set_flag.phpt
rename to amqp-1.7.0/tests/amqpexchange_set_flag.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_set_flags.phpt b/amqp-1.7.0/tests/amqpexchange_set_flags.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_set_flags.phpt
rename to amqp-1.7.0/tests/amqpexchange_set_flags.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_unbind.phpt b/amqp-1.7.0/tests/amqpexchange_unbind.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_unbind.phpt
rename to amqp-1.7.0/tests/amqpexchange_unbind.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_unbind_with_arguments.phpt b/amqp-1.7.0/tests/amqpexchange_unbind_with_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_unbind_with_arguments.phpt
rename to amqp-1.7.0/tests/amqpexchange_unbind_with_arguments.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_unbind_without_key.phpt b/amqp-1.7.0/tests/amqpexchange_unbind_without_key.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_unbind_without_key.phpt
rename to amqp-1.7.0/tests/amqpexchange_unbind_without_key.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_unbind_without_key_with_arguments.phpt b/amqp-1.7.0/tests/amqpexchange_unbind_without_key_with_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_unbind_without_key_with_arguments.phpt
rename to amqp-1.7.0/tests/amqpexchange_unbind_without_key_with_arguments.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpexchange_var_dump.phpt b/amqp-1.7.0/tests/amqpexchange_var_dump.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpexchange_var_dump.phpt
rename to amqp-1.7.0/tests/amqpexchange_var_dump.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_attributes.phpt b/amqp-1.7.0/tests/amqpqueue_attributes.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_attributes.phpt
rename to amqp-1.7.0/tests/amqpqueue_attributes.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_bind_basic.phpt b/amqp-1.7.0/tests/amqpqueue_bind_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_bind_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_bind_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_bind_basic_empty_routing_key.phpt b/amqp-1.7.0/tests/amqpqueue_bind_basic_empty_routing_key.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_bind_basic_empty_routing_key.phpt
rename to amqp-1.7.0/tests/amqpqueue_bind_basic_empty_routing_key.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_bind_basic_headers_arguments.phpt b/amqp-1.7.0/tests/amqpqueue_bind_basic_headers_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_bind_basic_headers_arguments.phpt
rename to amqp-1.7.0/tests/amqpqueue_bind_basic_headers_arguments.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_cancel.phpt b/amqp-1.7.0/tests/amqpqueue_cancel.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_cancel.phpt
rename to amqp-1.7.0/tests/amqpqueue_cancel.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_construct_basic.phpt b/amqp-1.7.0/tests/amqpqueue_construct_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_construct_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_construct_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_consume_basic.phpt b/amqp-1.7.0/tests/amqpqueue_consume_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_consume_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_consume_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_consume_multiple.phpt b/amqp-1.7.0/tests/amqpqueue_consume_multiple.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_consume_multiple.phpt
rename to amqp-1.7.0/tests/amqpqueue_consume_multiple.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_consume_multiple_no_doubles.phpt b/amqp-1.7.0/tests/amqpqueue_consume_multiple_no_doubles.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_consume_multiple_no_doubles.phpt
rename to amqp-1.7.0/tests/amqpqueue_consume_multiple_no_doubles.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_consume_nonexistent.phpt b/amqp-1.7.0/tests/amqpqueue_consume_nonexistent.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_consume_nonexistent.phpt
rename to amqp-1.7.0/tests/amqpqueue_consume_nonexistent.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_consume_timeout.phpt b/amqp-1.7.0/tests/amqpqueue_consume_timeout.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_consume_timeout.phpt
rename to amqp-1.7.0/tests/amqpqueue_consume_timeout.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_declare_basic.phpt b/amqp-1.7.0/tests/amqpqueue_declare_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_declare_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_declare_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_declare_with_arguments.phpt b/amqp-1.7.0/tests/amqpqueue_declare_with_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_declare_with_arguments.phpt
rename to amqp-1.7.0/tests/amqpqueue_declare_with_arguments.phpt
diff --git a/amqp-1.7.0/tests/amqpqueue_declare_with_stalled_reference.phpt b/amqp-1.7.0/tests/amqpqueue_declare_with_stalled_reference.phpt
new file mode 100644
index 0000000..9a21c3b
--- /dev/null
+++ b/amqp-1.7.0/tests/amqpqueue_declare_with_stalled_reference.phpt
@@ -0,0 +1,40 @@
+--TEST--
+AMQPQueue - declare with stalled reference
+--SKIPIF--
+<?php if (!extension_loaded("amqp")) print "skip"; ?>
+--FILE--
+<?php
+class ConnectionMock extends AMQPConnection {
+ public function __construct(array $credentials = array())
+ {
+ }
+}
+
+class ChannelMock extends AMQPChannel {
+ public function __construct(AMQPConnection $amqp_connection)
+ {
+ }
+}
+
+class QueueMock extends \AMQPQueue
+{
+ public function __construct(AMQPChannel $amqp_channel)
+ {
+ }
+}
+
+$cnn = new ConnectionMock();
+$ch = new ChannelMock($cnn);
+
+$e = new QueueMock($ch);
+
+
+try {
+ $e->declareQueue();
+} catch (\Exception $e) {
+ echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+}
+
+?>
+--EXPECT--
+AMQPChannelException: Could not declare queue. Stale reference to the channel object.
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_delete_basic.phpt b/amqp-1.7.0/tests/amqpqueue_delete_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_delete_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_delete_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_empty_name.phpt b/amqp-1.7.0/tests/amqpqueue_empty_name.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_empty_name.phpt
rename to amqp-1.7.0/tests/amqpqueue_empty_name.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_get_basic.phpt b/amqp-1.7.0/tests/amqpqueue_get_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_get_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_get_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_get_channel.phpt b/amqp-1.7.0/tests/amqpqueue_get_channel.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_get_channel.phpt
rename to amqp-1.7.0/tests/amqpqueue_get_channel.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_get_connection.phpt b/amqp-1.7.0/tests/amqpqueue_get_connection.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_get_connection.phpt
rename to amqp-1.7.0/tests/amqpqueue_get_connection.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_get_empty_body.phpt b/amqp-1.7.0/tests/amqpqueue_get_empty_body.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_get_empty_body.phpt
rename to amqp-1.7.0/tests/amqpqueue_get_empty_body.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_get_headers.phpt b/amqp-1.7.0/tests/amqpqueue_get_headers.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_get_headers.phpt
rename to amqp-1.7.0/tests/amqpqueue_get_headers.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_get_nonexistent.phpt b/amqp-1.7.0/tests/amqpqueue_get_nonexistent.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_get_nonexistent.phpt
rename to amqp-1.7.0/tests/amqpqueue_get_nonexistent.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_nack.phpt b/amqp-1.7.0/tests/amqpqueue_nack.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_nack.phpt
rename to amqp-1.7.0/tests/amqpqueue_nack.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_nested_arrays.phpt b/amqp-1.7.0/tests/amqpqueue_nested_arrays.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_nested_arrays.phpt
rename to amqp-1.7.0/tests/amqpqueue_nested_arrays.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_nested_headers.phpt b/amqp-1.7.0/tests/amqpqueue_nested_headers.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_nested_headers.phpt
rename to amqp-1.7.0/tests/amqpqueue_nested_headers.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_purge_basic.phpt b/amqp-1.7.0/tests/amqpqueue_purge_basic.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_purge_basic.phpt
rename to amqp-1.7.0/tests/amqpqueue_purge_basic.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_setArgument.phpt b/amqp-1.7.0/tests/amqpqueue_setArgument.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_setArgument.phpt
rename to amqp-1.7.0/tests/amqpqueue_setArgument.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_unbind_basic_empty_routing_key.phpt b/amqp-1.7.0/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
rename to amqp-1.7.0/tests/amqpqueue_unbind_basic_empty_routing_key.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_unbind_basic_headers_arguments.phpt b/amqp-1.7.0/tests/amqpqueue_unbind_basic_headers_arguments.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_unbind_basic_headers_arguments.phpt
rename to amqp-1.7.0/tests/amqpqueue_unbind_basic_headers_arguments.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpqueue_var_dump.phpt b/amqp-1.7.0/tests/amqpqueue_var_dump.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/amqpqueue_var_dump.phpt
rename to amqp-1.7.0/tests/amqpqueue_var_dump.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_17831.phpt b/amqp-1.7.0/tests/bug_17831.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_17831.phpt
rename to amqp-1.7.0/tests/bug_17831.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_19707.phpt b/amqp-1.7.0/tests/bug_19707.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_19707.phpt
rename to amqp-1.7.0/tests/bug_19707.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_19840.phpt b/amqp-1.7.0/tests/bug_19840.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_19840.phpt
rename to amqp-1.7.0/tests/bug_19840.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_61533.phpt b/amqp-1.7.0/tests/bug_61533.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_61533.phpt
rename to amqp-1.7.0/tests/bug_61533.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_62354.phpt b/amqp-1.7.0/tests/bug_62354.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_62354.phpt
rename to amqp-1.7.0/tests/bug_62354.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh147.phpt b/amqp-1.7.0/tests/bug_gh147.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh147.phpt
rename to amqp-1.7.0/tests/bug_gh147.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh155_direct_reply_to.phpt b/amqp-1.7.0/tests/bug_gh155_direct_reply_to.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh155_direct_reply_to.phpt
rename to amqp-1.7.0/tests/bug_gh155_direct_reply_to.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh50-1.phpt b/amqp-1.7.0/tests/bug_gh50-1.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh50-1.phpt
rename to amqp-1.7.0/tests/bug_gh50-1.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh50-2.phpt b/amqp-1.7.0/tests/bug_gh50-2.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh50-2.phpt
rename to amqp-1.7.0/tests/bug_gh50-2.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh50-3.phpt b/amqp-1.7.0/tests/bug_gh50-3.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh50-3.phpt
rename to amqp-1.7.0/tests/bug_gh50-3.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh50-4.phpt b/amqp-1.7.0/tests/bug_gh50-4.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh50-4.phpt
rename to amqp-1.7.0/tests/bug_gh50-4.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh53-2.phpt b/amqp-1.7.0/tests/bug_gh53-2.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh53-2.phpt
rename to amqp-1.7.0/tests/bug_gh53-2.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh53.phpt b/amqp-1.7.0/tests/bug_gh53.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh53.phpt
rename to amqp-1.7.0/tests/bug_gh53.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh72-1.phpt b/amqp-1.7.0/tests/bug_gh72-1.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh72-1.phpt
rename to amqp-1.7.0/tests/bug_gh72-1.phpt
diff --git a/amqp-1.7.0alpha2/tests/bug_gh72-2.phpt b/amqp-1.7.0/tests/bug_gh72-2.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/bug_gh72-2.phpt
rename to amqp-1.7.0/tests/bug_gh72-2.phpt
diff --git a/amqp-1.7.0alpha2/tests/package-version.phpt b/amqp-1.7.0/tests/package-version.phpt
similarity index 100%
rename from amqp-1.7.0alpha2/tests/package-version.phpt
rename to amqp-1.7.0/tests/package-version.phpt
diff --git a/amqp-1.7.0alpha2/tests/amqpconnection_heartbeat.phpt b/amqp-1.7.0alpha2/tests/amqpconnection_heartbeat.phpt
deleted file mode 100644
index 3f53224..0000000
--- a/amqp-1.7.0alpha2/tests/amqpconnection_heartbeat.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-AMQPConnection heartbeats support
---SKIPIF--
-<?php if (!extension_loaded("amqp")) print "skip"; ?>
---FILE--
-<?php
-$heartbeat = 2;
-$credentials = array('heartbeat' => $heartbeat);
-$cnn = new AMQPConnection($credentials);
-$cnn->connect();
-
-var_dump($cnn);
-
-sleep($heartbeat*10);
-
-try {
-$ch = new AMQPChannel($cnn);
-
-} catch (AMQPException $e) {
- echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
-}
-
-?>
---EXPECTF--
-object(AMQPConnection)#1 (11) {
- ["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]=>
- %s(5672)
- ["read_timeout":"AMQPConnection":private]=>
- %s(0)
- ["write_timeout":"AMQPConnection":private]=>
- %s(0)
- ["connect_timeout":"AMQPConnection":private]=>
- %s(0)
- ["channel_max":"AMQPConnection":private]=>
- %s(256)
- ["frame_max":"AMQPConnection":private]=>
- %s(131072)
- ["heartbeat":"AMQPConnection":private]=>
- %s(2)
-}
-AMQPException: Library error: a socket error occurred
\ No newline at end of file
diff --git a/package.xml b/package.xml
index c4b5d81..91502b4 100644
--- a/package.xml
+++ b/package.xml
@@ -1,744 +1,781 @@
<?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>
- <date>2015-12-21</date>
- <time>14:28:26</time>
+ <date>2016-04-26</date>
+ <time>14:00:45</time>
<version>
- <release>1.7.0alpha2</release>
+ <release>1.7.0</release>
<api>1.0.0</api>
</version>
<stability>
- <release>beta</release>
+ <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.7.0alpha1...v1.7.0alpha2
+https://github.com/pdezwart/php-amqp/compare/v1.6.0...v1.7.0
</notes>
<contents>
<dir name="/">
- <file md5sum="38bb32c983edf6ace1bcd6b606b6a372" name="amqp.c" role="src" />
- <file md5sum="fa376fb7888f98655285428918fde559" name="amqp_channel.c" role="src" />
+ <file md5sum="014bf3f2dc6df0c3a7646f05d65484a3" name="amqp.c" role="src" />
+ <file md5sum="d8f0ecb0a6f70750ec1cce10006c41a9" name="amqp_channel.c" role="src" />
<file md5sum="0d454a53c80dfcb29f8722dc1a2422c4" name="amqp_channel.h" role="src" />
- <file md5sum="49d37dd1354f55135eb4c6bb931f55e5" name="amqp_connection.c" role="src" />
- <file md5sum="7891564f09f0e01c63050055e9b766a9" name="amqp_connection.h" role="src" />
- <file md5sum="0acfb254004728d537f25efc1bf85c21" name="amqp_connection_resource.c" role="src" />
+ <file md5sum="8fce04be9f7866458ef0b72f0aa1aca2" name="amqp_connection.c" role="src" />
+ <file md5sum="c9574bd246e30279b807b324b7a44c8e" name="amqp_connection.h" role="src" />
+ <file md5sum="0924735a34a40de825d1ce8ab4c86e22" name="amqp_connection_resource.c" role="src" />
<file md5sum="a26ff5622b998fa2e9b0f489a3ba91d8" name="amqp_connection_resource.h" role="src" />
<file md5sum="dc959063b8da036cdbac53cf95f2a2d3" name="amqp_envelope.c" role="src" />
<file md5sum="b74f6e72cbe925d37a2850a690ec68fb" name="amqp_envelope.h" role="src" />
<file md5sum="7f1bb8aef7a1875d9744152e7bf28b59" name="amqp_exchange.c" role="src" />
<file md5sum="29bc658d47714e64fdac91330e0f30e5" name="amqp_exchange.h" role="src" />
<file md5sum="219d6dae3e50c286257dfde3a2facb87" name="amqp_queue.c" role="src" />
<file md5sum="98bd60d86a6313b68f59979c641af774" name="amqp_queue.h" role="src" />
- <file md5sum="29487565af6aa805537021a910422e5d" name="php5_support.h" role="src" />
- <file md5sum="b11187fd3ac05ac40860a6455e815232" name="php7_support.h" role="src" />
- <file md5sum="57004e8735e32f3acaa38b2d3886b889" name="php_amqp.h" role="src" />
- <file md5sum="d200246c81bad1e5ecff89ba0247ab28" name="config.m4" role="src" />
- <file md5sum="1518f35a7beb49a2d83575eaa1b84865" name="config.w32" role="src" />
+ <file md5sum="e6a0bb12ddfb92719259ba531c092cad" name="php5_support.h" role="src" />
+ <file md5sum="52b8a355742ae108e27c0fca46f72d09" name="php7_support.h" role="src" />
+ <file md5sum="262e2a7579540a653a8eb986b72f8fbc" name="php_amqp.h" role="src" />
+ <file md5sum="41cb0d18585cf6c6cd1d2a710e81638b" name="config.m4" role="src" />
+ <file md5sum="a1374c4c873c7a4ab7d1a1f4572baf16" 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="3d2f028b7fceb8cf35e56237338af93d" name="stubs/AMQP.php" role="doc" />
<file md5sum="6709d02e03739e36715987b4b1d1cbe3" name="stubs/AMQPChannel.php" role="doc" />
<file md5sum="d79254277f60751c4ba6697333af5d37" name="stubs/AMQPChannelException.php" role="doc" />
- <file md5sum="7c5888f281518863f2bf9adf6bae0d0c" name="stubs/AMQPConnection.php" role="doc" />
+ <file md5sum="4b583a70340946531387ad85c6ffab95" name="stubs/AMQPConnection.php" role="doc" />
<file md5sum="da1cd6ac1b51f2433904ce770e6f4ca3" name="stubs/AMQPConnectionException.php" role="doc" />
<file md5sum="5b31c8b75a49b122fe72c32c8c1ff59a" name="stubs/AMQPEnvelope.php" role="doc" />
<file md5sum="0b9b43b817a884d311f8f8013d8a5adc" name="stubs/AMQPException.php" role="doc" />
- <file md5sum="6382e8be47e1230bd769cf1b47451997" name="stubs/AMQPExchange.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="d7da0562e86197fc6bb0d12af0a25495" name="stubs/AMQPQueueException.php" role="doc" />
<file md5sum="62f984cea2d8bc5a06db4613512850fc" name="tests/_test_helpers.php.inc" role="test" />
<file md5sum="a0301397259981c1946f7c59c01308dd" name="tests/amqpchannel_basicRecover.phpt" role="test" />
<file md5sum="804eb9007733180f4300197288e7cd30" name="tests/amqpchannel_construct_basic.phpt" role="test" />
- <file md5sum="9c9cc955cdfd88e9824613aa90cc07aa" name="tests/amqpchannel_get_connection.phpt" role="test" />
<file md5sum="fbb15ebdf594756a61ff250318fbecbc" name="tests/amqpchannel_getChannelId.phpt" role="test" />
- <file md5sum="01d45f7bd3a1c41cb967ff0e1008b968" name="tests/amqpchannel_multi_channel_connection.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="f1917f805476ef23a712b177a2663778" name="tests/amqpchannel_var_dump.phpt" role="test" />
<file md5sum="6c380b88cdd43f18c4d2a9e226fe0b60" 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="756da50d19cbc4665b16efb389404421" name="tests/amqpconnection_construct_with_connect_timeout.phpt" role="test" />
+ <file md5sum="f851af4db4ff8b90ea80cb9bc395cee5" name="tests/amqpconnection_construct_with_connect_timeout.phpt" role="test" />
<file md5sum="042d3431112a369ac17a642d9fdc2b11" name="tests/amqpconnection_construct_with_limits.phpt" role="test" />
- <file md5sum="71943060ef1010289ab73222cc098cb0" name="tests/amqpconnection_construct_with_timeout.phpt" role="test" />
- <file md5sum="251f182e831e2ccfaf02fdc2f7babd58" name="tests/amqpconnection_construct_with_timeout_and_read_timeout.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="8aa51481f9cfaa8164bd8d1de30cf38f" name="tests/amqpconnection_heartbeat.phpt" role="test" />
+ <file md5sum="57a0cba0490452093d7ea60b572b664c" name="tests/amqpconnection_heartbeat.phpt" role="test" />
<file md5sum="4f8d0a154106a45e1e25c43818b93b67" name="tests/amqpconnection_heartbeat_with_consumer.phpt" role="test" />
+ <file md5sum="c912cbcf9f81d06cec06473700262893" name="tests/amqpconnection_heartbeat_with_persistent.phpt" role="test" />
<file md5sum="9e7f8576ff71311929ecae5119712906" name="tests/amqpconnection_persistent_construct_basic.phpt" role="test" />
<file md5sum="cc14d8575873810f182d6a5caf88e9f1" 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="f27e48180e45ffaff7fc2945b2bb6718" name="tests/amqpconnection_toomanychannels.phpt" role="test" />
<file md5sum="d98dda1d117bd865e8f66528e1b0fc04" name="tests/amqpconnection_var_dump.phpt" role="test" />
<file md5sum="8f90f050a53b2282dd5a128b59090c04" name="tests/amqpenvelope_construct.phpt" role="test" />
<file md5sum="161808887e2fe1de616358d317e2e864" name="tests/amqpenvelope_get_accessors.phpt" role="test" />
<file md5sum="c68a52e419cf2eae84b2b06ed67668fd" name="tests/amqpenvelope_var_dump.phpt" role="test" />
<file md5sum="30f0ddcd3250d0c6d95cad54ae7d0f29" 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="e910acd5d274bb722be2e4c5c564eacf" name="tests/amqpexchange_declare_existent.phpt" role="test" />
+ <file md5sum="d7a2c25b330285bb5b3818beb5d9e292" name="tests/amqpexchange_declare_with_stalled_reference.phpt" role="test" />
<file md5sum="f23ce6bce7828675f4ab2229ff909b09" name="tests/amqpexchange_declare_without_name.phpt" role="test" />
<file md5sum="c11306122ecaee5dd84ab45ba1c83fc2" name="tests/amqpexchange_declare_without_type.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="bf2e1921405cd73178fba23fdc94812c" name="tests/amqpexchange_invalid_type.phpt" role="test" />
<file md5sum="28d40d0147069b95f19370dabcc05d51" name="tests/amqpexchange_publish_basic.phpt" role="test" />
<file md5sum="4d07c2070b00e062b8dbeb3ba47e7423" name="tests/amqpexchange_publish_empty_routing_key.phpt" role="test" />
<file md5sum="ad68e777e537d8610bab90d3fcb8eb50" name="tests/amqpexchange_publish_timeout.disabled" 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="100a493cfe499876c744c6320021f6d5" name="tests/amqpexchange_publish_with_properties_ignore_num_header.phpt" role="test" />
<file md5sum="e70ffc740233f2a84d6e98234584c195" 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="4137d0f1d5b6a9e6a9cf08a0f25bd3fc" name="tests/amqpexchange_publish_with_properties_user_id_failure.phpt" role="test" />
+ <file md5sum="d492b21a3377b56f412fc5e7598cc9f6" name="tests/amqpexchange_setArgument.phpt" role="test" />
<file md5sum="6692eef7a0bb10e53ef74e1809e3dd85" name="tests/amqpexchange_set_flag.phpt" role="test" />
<file md5sum="72246bd590a606e6c6241cfb4276a1d2" name="tests/amqpexchange_set_flags.phpt" role="test" />
- <file md5sum="d492b21a3377b56f412fc5e7598cc9f6" name="tests/amqpexchange_setArgument.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="a9f0f43687589217617202ee6c42c839" name="tests/amqpexchange_var_dump.phpt" role="test" />
<file md5sum="e4497ed4ca0eb82c5c757714adbcc922" 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="5e36e341a8797edeee72397d8adcb7bb" name="tests/amqpqueue_consume_multiple_no_doubles.phpt" role="test" />
<file md5sum="3cfe9025a23532d552f23fc54d2826d8" name="tests/amqpqueue_consume_nonexistent.phpt" role="test" />
<file md5sum="036b629ee10295b0807c73719f22c27f" 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="47e3a1281d79d093d4b72905b67beddf" 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="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="a591a624eb357a0ef50fc71f0465974d" name="tests/amqpqueue_get_nonexistent.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="48b536f91b376a32aad882a14ad26b59" name="tests/amqpqueue_nested_headers.phpt" role="test" />
<file md5sum="abaf080a5feab914919e8bcf837e9d83" name="tests/amqpqueue_purge_basic.phpt" role="test" />
<file md5sum="300752e855d987475b120082400677c0" 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="6b98df625b9028965720fcfde8a5042e" name="tests/amqpqueue_var_dump.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="aac2b2dbbea1bef2322ac549e416ca38" name="tests/bug_19840.phpt" role="test" />
<file md5sum="cbbb08c5c32b68a0b42a59a9d760c4a7" name="tests/bug_61533.phpt" role="test" />
<file md5sum="70c4b1222072be9591ff0f2d6bd4a0c9" name="tests/bug_62354.phpt" role="test" />
+ <file md5sum="4f646dfe852ca88d292c987b4b16a71f" 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="6dab7744024b4d6258141513c15ed102" name="tests/bug_gh53.phpt" role="test" />
<file md5sum="b7c71b6b0c0653eafe9f8caa15335975" name="tests/bug_gh53-2.phpt" role="test" />
+ <file md5sum="6dab7744024b4d6258141513c15ed102" name="tests/bug_gh53.phpt" role="test" />
<file md5sum="d8de8918a3c73ebdcb4159581ea58b5f" name="tests/bug_gh72-1.phpt" role="test" />
<file md5sum="0bed5ba885ea925a6045502569a1e946" name="tests/bug_gh72-2.phpt" role="test" />
- <file md5sum="4f646dfe852ca88d292c987b4b16a71f" name="tests/bug_gh147.phpt" role="test" />
- <file md5sum="6157e371b447ebf125b36340ebbac39c" name="tests/bug_gh155_direct_reply_to.phpt" role="test" />
<file md5sum="212e44c003f3b950b3f85958fdc5a367" name="tests/package-version.phpt" role="test" />
</dir>
</contents>
<dependencies>
<required>
<php>
- <min>5.2.0</min>
+ <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.7.0-dev</release>
+ <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, Jan 30, 3:37 PM (5 d, 10 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55480
Default Alt Text
(254 KB)

Event Timeline