summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-01-14 13:22:10 +0100
committerRemi Collet <remi@remirepo.net>2021-01-14 13:22:10 +0100
commite3604ed86088cca661ba9bec70b45d7a8ec8722c (patch)
treeab3c1c961397409e70868673526ccf0b948ed7d3
parent102424724e96cc06f248582502f34b2b878eb212 (diff)
cleanup
-rw-r--r--php-pecl-rdkafka4.spec13
-rw-r--r--rdkafka-php8.patch5075
2 files changed, 3 insertions, 5085 deletions
diff --git a/php-pecl-rdkafka4.spec b/php-pecl-rdkafka4.spec
index d5fd8dc..1c05f3f 100644
--- a/php-pecl-rdkafka4.spec
+++ b/php-pecl-rdkafka4.spec
@@ -1,6 +1,6 @@
# remirepo/fedora spec file for php-pecl-rdkafka4
#
-# Copyright (c) 2015-2020 Remi Collet
+# Copyright (c) 2015-2021 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -26,14 +26,11 @@ License: MIT
URL: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
-# git checkout master; git diff 4.1.2 -- *h *.c tests/ >/tmp/pp
-# + cleanup (version, produce_consume_transactional.phpt)
-Patch0: %{pecl_name}-php8.patch
-
-BuildRequires: %{?dtsprefix}gcc
BuildRequires: make
+BuildRequires: %{?dtsprefix}gcc
BuildRequires: librdkafka1php-devel
BuildRequires: %{?scl_prefix}php-devel >= 5.6
+BuildRequires: %{?scl_prefix}php-devel < 8
BuildRequires: %{?scl_prefix}php-pear
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
@@ -89,10 +86,6 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
-%if "%{php_version}" > "8.0"
-%patch0 -p1 -b .up
-%endif
-
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_RDKAFKA_VERSION/{s/.* "//;s/".*$//;p}' php_rdkafka.h)
if test "x${extver}" != "x%{version}"; then
diff --git a/rdkafka-php8.patch b/rdkafka-php8.patch
deleted file mode 100644
index a574191..0000000
--- a/rdkafka-php8.patch
+++ /dev/null
@@ -1,5075 +0,0 @@
-diff --git a/conf.c b/conf.c
-index 2e4fe99..1ec2e59 100644
---- a/conf.c
-+++ b/conf.c
-@@ -31,14 +31,13 @@
- #include "conf.h"
- #include "topic_partition.h"
- #include "message.h"
--#include "zeval.h"
-
- zend_class_entry * ce_kafka_conf;
- zend_class_entry * ce_kafka_topic_conf;
-
- static zend_object_handlers handlers;
-
--static void kafka_conf_callback_dtor(kafka_conf_callback *cb TSRMLS_DC) /* {{{ */
-+static void kafka_conf_callback_dtor(kafka_conf_callback *cb) /* {{{ */
- {
- if (cb) {
- zval_ptr_dtor(&cb->fci.function_name);
-@@ -46,58 +45,54 @@ static void kafka_conf_callback_dtor(kafka_conf_callback *cb TSRMLS_DC) /* {{{ *
- }
- } /* }}} */
-
--void kafka_conf_callbacks_dtor(kafka_conf_callbacks *cbs TSRMLS_DC) /* {{{ */
-+void kafka_conf_callbacks_dtor(kafka_conf_callbacks *cbs) /* {{{ */
- {
-- kafka_conf_callback_dtor(cbs->error TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->error);
- cbs->error = NULL;
-- kafka_conf_callback_dtor(cbs->rebalance TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->rebalance);
- cbs->rebalance = NULL;
-- kafka_conf_callback_dtor(cbs->dr_msg TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->dr_msg);
- cbs->dr_msg = NULL;
-- kafka_conf_callback_dtor(cbs->stats TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->stats);
- cbs->stats = NULL;
-- kafka_conf_callback_dtor(cbs->consume TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->consume);
- cbs->consume = NULL;
-- kafka_conf_callback_dtor(cbs->offset_commit TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->offset_commit);
- cbs->offset_commit = NULL;
-- kafka_conf_callback_dtor(cbs->log TSRMLS_CC);
-+ kafka_conf_callback_dtor(cbs->log);
- cbs->log = NULL;
- } /* }}} */
-
--static void kafka_conf_callback_copy(kafka_conf_callback **to, kafka_conf_callback *from TSRMLS_DC) /* {{{ */
-+static void kafka_conf_callback_copy(kafka_conf_callback **to, kafka_conf_callback *from) /* {{{ */
- {
- if (from) {
- *to = emalloc(sizeof(**to));
- **to = *from;
--#if PHP_MAJOR_VERSION >= 7
- zval_copy_ctor(&(*to)->fci.function_name);
--#else
-- Z_ADDREF_P((*to)->fci.function_name);
--#endif
- }
- } /* }}} */
-
--void kafka_conf_callbacks_copy(kafka_conf_callbacks *to, kafka_conf_callbacks *from TSRMLS_DC) /* {{{ */
-+void kafka_conf_callbacks_copy(kafka_conf_callbacks *to, kafka_conf_callbacks *from) /* {{{ */
- {
-- kafka_conf_callback_copy(&to->error, from->error TSRMLS_CC);
-- kafka_conf_callback_copy(&to->rebalance, from->rebalance TSRMLS_CC);
-- kafka_conf_callback_copy(&to->dr_msg, from->dr_msg TSRMLS_CC);
-- kafka_conf_callback_copy(&to->stats, from->stats TSRMLS_CC);
-- kafka_conf_callback_copy(&to->consume, from->consume TSRMLS_CC);
-- kafka_conf_callback_copy(&to->offset_commit, from->offset_commit TSRMLS_CC);
-- kafka_conf_callback_copy(&to->log, from->log TSRMLS_CC);
-+ kafka_conf_callback_copy(&to->error, from->error);
-+ kafka_conf_callback_copy(&to->rebalance, from->rebalance);
-+ kafka_conf_callback_copy(&to->dr_msg, from->dr_msg);
-+ kafka_conf_callback_copy(&to->stats, from->stats);
-+ kafka_conf_callback_copy(&to->consume, from->consume);
-+ kafka_conf_callback_copy(&to->offset_commit, from->offset_commit);
-+ kafka_conf_callback_copy(&to->log, from->log);
- } /* }}} */
-
--static void kafka_conf_free(zend_object *object TSRMLS_DC) /* {{{ */
-+static void kafka_conf_free(zend_object *object) /* {{{ */
- {
-- kafka_conf_object *intern = get_custom_object(kafka_conf_object, object);
-+ kafka_conf_object *intern = php_kafka_from_obj(kafka_conf_object, object);
-
- switch (intern->type) {
- case KAFKA_CONF:
- if (intern->u.conf) {
- rd_kafka_conf_destroy(intern->u.conf);
- }
-- kafka_conf_callbacks_dtor(&intern->cbs TSRMLS_CC);
-+ kafka_conf_callbacks_dtor(&intern->cbs);
- break;
- case KAFKA_TOPIC_CONF:
- if (intern->u.topic_conf) {
-@@ -106,34 +101,32 @@ static void kafka_conf_free(zend_object *object TSRMLS_DC) /* {{{ */
- break;
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value kafka_conf_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *kafka_conf_new(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- kafka_conf_object *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, kafka_conf_free, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--kafka_conf_object * get_kafka_conf_object(zval *zconf TSRMLS_DC)
-+kafka_conf_object * get_kafka_conf_object(zval *zconf)
- {
-- kafka_conf_object *oconf = get_custom_object_zval(kafka_conf_object, zconf);
-+ kafka_conf_object *oconf = Z_RDKAFKA_P(kafka_conf_object, zconf);
-
- if (!oconf->type) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Conf::__construct() has not been called" TSRMLS_CC);
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Conf::__construct() has not been called");
- return NULL;
- }
-
-@@ -143,8 +136,7 @@ kafka_conf_object * get_kafka_conf_object(zval *zconf TSRMLS_DC)
- static void kafka_conf_error_cb(rd_kafka_t *rk, int err, const char *reason, void *opaque)
- {
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) opaque;
-- zeval args[3];
-- TSRMLS_FETCH();
-+ zval args[3];
-
- if (!opaque) {
- return;
-@@ -154,15 +146,15 @@ static void kafka_conf_error_cb(rd_kafka_t *rk, int err, const char *reason, voi
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-- MAKE_STD_ZEVAL(args[2]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-+ ZVAL_NULL(&args[2]);
-
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[0]), &cbs->zrk, 1, 0);
-- ZVAL_LONG(P_ZEVAL(args[1]), err);
-- RDKAFKA_ZVAL_STRING(P_ZEVAL(args[2]), reason);
-+ ZVAL_ZVAL(&args[0], &cbs->zrk, 1, 0);
-+ ZVAL_LONG(&args[1], err);
-+ ZVAL_STRING(&args[2], reason);
-
-- rdkafka_call_function(&cbs->error->fci, &cbs->error->fcc, NULL, 3, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->error->fci, &cbs->error->fcc, NULL, 3, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -172,8 +164,7 @@ static void kafka_conf_error_cb(rd_kafka_t *rk, int err, const char *reason, voi
- static void kafka_conf_dr_msg_cb(rd_kafka_t *rk, const rd_kafka_message_t *msg, void *opaque)
- {
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) opaque;
-- zeval args[2];
-- TSRMLS_FETCH();
-+ zval args[2];
-
- if (!opaque) {
- return;
-@@ -183,13 +174,13 @@ static void kafka_conf_dr_msg_cb(rd_kafka_t *rk, const rd_kafka_message_t *msg,
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[0]), &cbs->zrk, 1, 0);
-- kafka_message_new(P_ZEVAL(args[1]), msg TSRMLS_CC);
-+ ZVAL_ZVAL(&args[0], &cbs->zrk, 1, 0);
-+ kafka_message_new(&args[1], msg);
-
-- rdkafka_call_function(&cbs->dr_msg->fci, &cbs->dr_msg->fcc, NULL, 2, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->dr_msg->fci, &cbs->dr_msg->fcc, NULL, 2, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -198,8 +189,7 @@ static void kafka_conf_dr_msg_cb(rd_kafka_t *rk, const rd_kafka_message_t *msg,
- static int kafka_conf_stats_cb(rd_kafka_t *rk, char *json, size_t json_len, void *opaque)
- {
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) opaque;
-- zeval args[3];
-- TSRMLS_FETCH();
-+ zval args[3];
-
- if (!opaque) {
- return 0;
-@@ -209,15 +199,15 @@ static int kafka_conf_stats_cb(rd_kafka_t *rk, char *json, size_t json_len, void
- return 0;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-- MAKE_STD_ZEVAL(args[2]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-+ ZVAL_NULL(&args[2]);
-
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[0]), &cbs->zrk, 1, 0);
-- RDKAFKA_ZVAL_STRING(P_ZEVAL(args[1]), json);
-- ZVAL_LONG(P_ZEVAL(args[2]), json_len);
-+ ZVAL_ZVAL(&args[0], &cbs->zrk, 1, 0);
-+ ZVAL_STRING(&args[1], json);
-+ ZVAL_LONG(&args[2], json_len);
-
-- rdkafka_call_function(&cbs->stats->fci, &cbs->stats->fcc, NULL, 3, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->stats->fci, &cbs->stats->fcc, NULL, 3, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -229,8 +219,7 @@ static int kafka_conf_stats_cb(rd_kafka_t *rk, char *json, size_t json_len, void
- static void kafka_conf_rebalance_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err, rd_kafka_topic_partition_list_t *partitions, void *opaque)
- {
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) opaque;
-- zeval args[3];
-- TSRMLS_FETCH();
-+ zval args[3];
-
- if (!opaque) {
- return;
-@@ -240,22 +229,22 @@ static void kafka_conf_rebalance_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err, rd_
- err = rd_kafka_assign(rk, NULL);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-- MAKE_STD_ZEVAL(args[2]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-+ ZVAL_NULL(&args[2]);
-
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[0]), &cbs->zrk, 1, 0);
-- ZVAL_LONG(P_ZEVAL(args[1]), err);
-- kafka_topic_partition_list_to_array(P_ZEVAL(args[2]), partitions TSRMLS_CC);
-+ ZVAL_ZVAL(&args[0], &cbs->zrk, 1, 0);
-+ ZVAL_LONG(&args[1], err);
-+ kafka_topic_partition_list_to_array(&args[2], partitions);
-
-- rdkafka_call_function(&cbs->rebalance->fci, &cbs->rebalance->fcc, NULL, 3, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->rebalance->fci, &cbs->rebalance->fcc, NULL, 3, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -265,8 +254,7 @@ static void kafka_conf_rebalance_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err, rd_
- static void kafka_conf_consume_cb(rd_kafka_message_t *msg, void *opaque)
- {
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) opaque;
-- zeval args[2];
-- TSRMLS_FETCH();
-+ zval args[2];
-
- if (!opaque) {
- return;
-@@ -276,14 +264,14 @@ static void kafka_conf_consume_cb(rd_kafka_message_t *msg, void *opaque)
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-
-- kafka_message_new(P_ZEVAL(args[0]), msg TSRMLS_CC);
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[1]), &cbs->zrk, 1, 0);
-+ kafka_message_new(&args[0], msg);
-+ ZVAL_ZVAL(&args[1], &cbs->zrk, 1, 0);
-
-
-- rdkafka_call_function(&cbs->consume->fci, &cbs->consume->fcc, NULL, 2, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->consume->fci, &cbs->consume->fcc, NULL, 2, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -292,8 +280,7 @@ static void kafka_conf_consume_cb(rd_kafka_message_t *msg, void *opaque)
- static void kafka_conf_offset_commit_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err, rd_kafka_topic_partition_list_t *partitions, void *opaque)
- {
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) opaque;
-- zeval args[3];
-- TSRMLS_FETCH();
-+ zval args[3];
-
- if (!opaque) {
- return;
-@@ -303,15 +290,15 @@ static void kafka_conf_offset_commit_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err,
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-- MAKE_STD_ZEVAL(args[2]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-+ ZVAL_NULL(&args[2]);
-
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[0]), &cbs->zrk, 1, 0);
-- ZVAL_LONG(P_ZEVAL(args[1]), err);
-- kafka_topic_partition_list_to_array(P_ZEVAL(args[2]), partitions TSRMLS_CC);
-+ ZVAL_ZVAL(&args[0], &cbs->zrk, 1, 0);
-+ ZVAL_LONG(&args[1], err);
-+ kafka_topic_partition_list_to_array(&args[2], partitions);
-
-- rdkafka_call_function(&cbs->offset_commit->fci, &cbs->offset_commit->fcc, NULL, 3, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->offset_commit->fci, &cbs->offset_commit->fcc, NULL, 3, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -320,8 +307,7 @@ static void kafka_conf_offset_commit_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err,
-
- static void kafka_conf_log_cb(const rd_kafka_t *rk, int level, const char *facility, const char *message)
- {
-- zeval args[4];
-- TSRMLS_FETCH();
-+ zval args[4];
-
- kafka_conf_callbacks *cbs = (kafka_conf_callbacks*) rd_kafka_opaque(rk);
-
-@@ -329,17 +315,17 @@ static void kafka_conf_log_cb(const rd_kafka_t *rk, int level, const char *facil
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-- MAKE_STD_ZEVAL(args[1]);
-- MAKE_STD_ZEVAL(args[2]);
-- MAKE_STD_ZEVAL(args[3]);
-+ ZVAL_NULL(&args[0]);
-+ ZVAL_NULL(&args[1]);
-+ ZVAL_NULL(&args[2]);
-+ ZVAL_NULL(&args[3]);
-
-- KAFKA_ZVAL_ZVAL(P_ZEVAL(args[0]), &cbs->zrk, 1, 0);
-- ZVAL_LONG(P_ZEVAL(args[1]), level);
-- RDKAFKA_ZVAL_STRING(P_ZEVAL(args[2]), facility);
-- RDKAFKA_ZVAL_STRING(P_ZEVAL(args[3]), message);
-+ ZVAL_ZVAL(&args[0], &cbs->zrk, 1, 0);
-+ ZVAL_LONG(&args[1], level);
-+ ZVAL_STRING(&args[2], facility);
-+ ZVAL_STRING(&args[3], message);
-
-- rdkafka_call_function(&cbs->log->fci, &cbs->log->fcc, NULL, 4, args TSRMLS_CC);
-+ rdkafka_call_function(&cbs->log->fci, &cbs->log->fcc, NULL, 4, args);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
-@@ -357,18 +343,18 @@ PHP_METHOD(RdKafka__Conf, __construct)
- kafka_conf_object *intern;
- zend_error_handling error_handling;
-
-- zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
-+ zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
-+ zend_restore_error_handling(&error_handling);
- return;
- }
-
-- intern = get_custom_object_zval(kafka_conf_object, getThis());
-+ intern = Z_RDKAFKA_P(kafka_conf_object, getThis());
- intern->type = KAFKA_CONF;
- intern->u.conf = rd_kafka_conf_new();
-
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
- }
- /* }}} */
-
-@@ -385,11 +371,11 @@ PHP_METHOD(RdKafka__Conf, dump)
- kafka_conf_object *intern;
- size_t i;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-@@ -410,7 +396,7 @@ PHP_METHOD(RdKafka__Conf, dump)
- for (i = 0; i < cntp; i+=2) {
- const char *key = dump[i];
- const char *value = dump[i+1];
-- rdkafka_add_assoc_string(return_value, (char*)key, (char*)value);
-+ add_assoc_string(return_value, (char*)key, (char*)value);
- }
-
- rd_kafka_conf_dump_free(dump, cntp);
-@@ -428,18 +414,18 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__Conf, set)
- {
- char *name;
-- arglen_t name_len;
-+ size_t name_len;
- char *value;
-- arglen_t value_len;
-+ size_t value_len;
- kafka_conf_object *intern;
- rd_kafka_conf_res_t ret = 0;
- char errstr[512];
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-@@ -457,10 +443,10 @@ PHP_METHOD(RdKafka__Conf, set)
-
- switch (ret) {
- case RD_KAFKA_CONF_UNKNOWN:
-- zend_throw_exception(ce_kafka_exception, errstr, RD_KAFKA_CONF_UNKNOWN TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, errstr, RD_KAFKA_CONF_UNKNOWN);
- return;
- case RD_KAFKA_CONF_INVALID:
-- zend_throw_exception(ce_kafka_exception, errstr, RD_KAFKA_CONF_INVALID TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, errstr, RD_KAFKA_CONF_INVALID);
- return;
- case RD_KAFKA_CONF_OK:
- break;
-@@ -481,16 +467,16 @@ PHP_METHOD(RdKafka__Conf, setDefaultTopicConf)
- kafka_conf_object *topic_conf_intern;
- rd_kafka_topic_conf_t *topic_conf;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &ztopic_conf, ce_kafka_topic_conf) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &ztopic_conf, ce_kafka_topic_conf) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- topic_conf_intern = get_kafka_conf_object(ztopic_conf TSRMLS_CC);
-+ topic_conf_intern = get_kafka_conf_object(ztopic_conf);
- if (!topic_conf_intern) {
- return;
- }
-@@ -514,16 +500,16 @@ PHP_METHOD(RdKafka__Conf, setErrorCb)
- zend_fcall_info_cache fcc;
- kafka_conf_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (intern->cbs.error) {
- zval_ptr_dtor(&intern->cbs.error->fci.function_name);
-@@ -551,16 +537,16 @@ PHP_METHOD(RdKafka__Conf, setDrMsgCb)
- zend_fcall_info_cache fcc;
- kafka_conf_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (intern->cbs.dr_msg) {
- zval_ptr_dtor(&intern->cbs.dr_msg->fci.function_name);
-@@ -588,16 +574,16 @@ PHP_METHOD(RdKafka__Conf, setStatsCb)
- zend_fcall_info_cache fcc;
- kafka_conf_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (intern->cbs.stats) {
- zval_ptr_dtor(&intern->cbs.stats->fci.function_name);
-@@ -625,16 +611,16 @@ PHP_METHOD(RdKafka__Conf, setRebalanceCb)
- zend_fcall_info_cache fcc;
- kafka_conf_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (intern->cbs.rebalance) {
- zval_ptr_dtor(&intern->cbs.rebalance->fci.function_name);
-@@ -662,16 +648,16 @@ PHP_METHOD(RdKafka__Conf, setConsumeCb)
- zend_fcall_info_cache fcc;
- kafka_conf_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (intern->cbs.consume) {
- zval_ptr_dtor(&intern->cbs.consume->fci.function_name);
-@@ -699,16 +685,16 @@ PHP_METHOD(RdKafka__Conf, setOffsetCommitCb)
- zend_fcall_info_cache fcc;
- kafka_conf_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (intern->cbs.offset_commit) {
- zval_ptr_dtor(&intern->cbs.offset_commit->fci.function_name);
-@@ -737,16 +723,16 @@ PHP_METHOD(RdKafka__Conf, setLogCb)
- kafka_conf_object *conf;
- char errstr[512];
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fci, &fcc) == FAILURE) {
- return;
- }
-
-- conf = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ conf = get_kafka_conf_object(getThis());
- if (!conf) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(fci.function_name));
-+ Z_ADDREF_P(&fci.function_name);
-
- if (conf->cbs.log) {
- zval_ptr_dtor(&conf->cbs.log->fci.function_name);
-@@ -768,18 +754,18 @@ PHP_METHOD(RdKafka__TopicConf, __construct)
- kafka_conf_object *intern;
- zend_error_handling error_handling;
-
-- zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
-+ zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
-+ zend_restore_error_handling(&error_handling);
- return;
- }
-
-- intern = get_custom_object_zval(kafka_conf_object, getThis());
-+ intern = Z_RDKAFKA_P(kafka_conf_object, getThis());
- intern->type = KAFKA_TOPIC_CONF;
- intern->u.topic_conf = rd_kafka_topic_conf_new();
-
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
- }
- /* }}} */
-
-@@ -795,11 +781,11 @@ PHP_METHOD(RdKafka__TopicConf, setPartitioner)
- zend_long id;
- int32_t (*partitioner) (const rd_kafka_topic_t * rkt, const void * keydata, size_t keylen, int32_t partition_cnt, void * rkt_opaque, void * msg_opaque);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_conf_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_conf_object(getThis());
- if (!intern) {
- return;
- }
-@@ -823,7 +809,7 @@ PHP_METHOD(RdKafka__TopicConf, setPartitioner)
- break;
- #endif
- default:
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Invalid partitioner given" TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid partitioner given");
- return;
- }
-
-@@ -854,19 +840,19 @@ static const zend_function_entry kafka_conf_fe[] = {
- PHP_FE_END
- };
-
--void kafka_conf_minit(TSRMLS_D)
-+void kafka_conf_minit(INIT_FUNC_ARGS)
- {
- zend_class_entry tmpce;
-
- handlers = kafka_default_object_handlers;
-- set_object_handler_free_obj(&handlers, kafka_conf_free);
-- set_object_handler_offset(&handlers, XtOffsetOf(kafka_conf_object, std));
-+ handlers.free_obj = kafka_conf_free;
-+ handlers.offset = XtOffsetOf(kafka_conf_object, std);
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "Conf", kafka_conf_fe);
-- ce_kafka_conf = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce_kafka_conf = zend_register_internal_class(&tmpce);
- ce_kafka_conf->create_object = kafka_conf_new;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "TopicConf", kafka_topic_conf_fe);
-- ce_kafka_topic_conf = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce_kafka_topic_conf = zend_register_internal_class(&tmpce);
- ce_kafka_topic_conf->create_object = kafka_conf_new;
- }
-diff --git a/conf.h b/conf.h
-index 3ec6bcf..9778eb5 100644
---- a/conf.h
-+++ b/conf.h
-@@ -49,25 +49,20 @@ typedef struct _kafka_conf_callbacks {
- } kafka_conf_callbacks;
-
- typedef struct _kafka_conf_object {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- kafka_conf_type type;
- union {
- rd_kafka_conf_t *conf;
- rd_kafka_topic_conf_t *topic_conf;
- } u;
- kafka_conf_callbacks cbs;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } kafka_conf_object;
-
--kafka_conf_object * get_kafka_conf_object(zval *zconf TSRMLS_DC);
--void kafka_conf_minit(TSRMLS_D);
-+kafka_conf_object * get_kafka_conf_object(zval *zconf);
-+void kafka_conf_minit(INIT_FUNC_ARGS);
-
--void kafka_conf_callbacks_dtor(kafka_conf_callbacks *cbs TSRMLS_DC);
--void kafka_conf_callbacks_copy(kafka_conf_callbacks *to, kafka_conf_callbacks *from TSRMLS_DC);
-+void kafka_conf_callbacks_dtor(kafka_conf_callbacks *cbs);
-+void kafka_conf_callbacks_copy(kafka_conf_callbacks *to, kafka_conf_callbacks *from);
-
- extern zend_class_entry * ce_kafka_conf;
- extern zend_class_entry * ce_kafka_topic_conf;
-diff --git a/fun.c b/fun.c
-index b5231ce..d73e202 100644
---- a/fun.c
-+++ b/fun.c
-@@ -26,7 +26,6 @@
- #include "librdkafka/rdkafka.h"
- #include "Zend/zend_exceptions.h"
- #include "ext/spl/spl_exceptions.h"
--#include "zeval.h"
-
- /* {{{ arginfo */
- ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_get_err_descs, 0, 0, 0)
-@@ -71,7 +70,7 @@ PHP_FUNCTION(rd_kafka_get_err_descs)
-
- for (i = 0; i < cnt; i++) {
- const struct rd_kafka_err_desc *desc = &errdescs[i];
-- zeval el;
-+ zval el;
-
- if (desc->code == 0) {
- if (seen_zero) {
-@@ -80,20 +79,20 @@ PHP_FUNCTION(rd_kafka_get_err_descs)
- seen_zero = 1;
- }
-
-- MAKE_STD_ZEVAL(el);
-- array_init(P_ZEVAL(el));
-- add_assoc_long(P_ZEVAL(el), "code", desc->code);
-+ ZVAL_NULL(&el);
-+ array_init(&el);
-+ add_assoc_long(&el, "code", desc->code);
- if (desc->name) {
-- rdkafka_add_assoc_string(P_ZEVAL(el), "name", (char*) desc->name);
-+ add_assoc_string(&el, "name", (char*) desc->name);
- } else {
-- add_assoc_null(P_ZEVAL(el), "name");
-+ add_assoc_null(&el, "name");
- }
- if (desc->desc) {
-- rdkafka_add_assoc_string(P_ZEVAL(el), "desc", (char*) desc->desc);
-+ add_assoc_string(&el, "desc", (char*) desc->desc);
- }else {
-- add_assoc_null(P_ZEVAL(el), "desc");
-+ add_assoc_null(&el, "desc");
- }
-- add_next_index_zval(return_value, P_ZEVAL(el));
-+ add_next_index_zval(return_value, &el);
- }
- }
- /* }}} */
-@@ -106,14 +105,14 @@ PHP_FUNCTION(rd_kafka_err2str)
- zend_long err;
- const char *errstr;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &err) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &err) == FAILURE) {
- return;
- }
-
- errstr = rd_kafka_err2str(err);
-
- if (errstr) {
-- RDKAFKA_RETURN_STRING(errstr);
-+ RETURN_STRING(errstr);
- }
- }
- /* }}} */
-@@ -122,7 +121,7 @@ PHP_FUNCTION(rd_kafka_err2str)
- * Returns `errno` */
- PHP_FUNCTION(rd_kafka_errno)
- {
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-@@ -136,7 +135,7 @@ PHP_FUNCTION(rd_kafka_errno2err)
- {
- zend_long errnox;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &errnox) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &errnox) == FAILURE) {
- return;
- }
-
-@@ -164,7 +163,7 @@ PHP_FUNCTION(rd_kafka_offset_tail)
- {
- zend_long cnt;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cnt) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &cnt) == FAILURE) {
- return;
- }
-
-diff --git a/kafka_consumer.c b/kafka_consumer.c
-index 5ee209a..f1b596a 100644
---- a/kafka_consumer.c
-+++ b/kafka_consumer.c
-@@ -33,24 +33,19 @@
- #include "metadata.h"
-
- typedef struct _object_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- rd_kafka_t *rk;
- kafka_conf_callbacks cbs;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } object_intern;
-
- static zend_class_entry * ce;
- static zend_object_handlers handlers;
-
--static void kafka_consumer_free(zend_object *object TSRMLS_DC) /* {{{ */
-+static void kafka_consumer_free(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
- rd_kafka_resp_err_t err;
-- kafka_conf_callbacks_dtor(&intern->cbs TSRMLS_CC);
-+ kafka_conf_callbacks_dtor(&intern->cbs);
-
- if (intern->rk) {
- err = rd_kafka_consumer_close(intern->rk);
-@@ -63,36 +58,34 @@ static void kafka_consumer_free(zend_object *object TSRMLS_DC) /* {{{ */
- intern->rk = NULL;
- }
-
-- kafka_conf_callbacks_dtor(&intern->cbs TSRMLS_CC);
--
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
-+ kafka_conf_callbacks_dtor(&intern->cbs);
-
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value kafka_consumer_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *kafka_consumer_new(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, kafka_consumer_free, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *zconsumer TSRMLS_DC) /* {{{ */
-+static object_intern * get_object(zval *zconsumer) /* {{{ */
- {
-- object_intern *oconsumer = get_custom_object_zval(object_intern, zconsumer);
-+ object_intern *oconsumer = Z_RDKAFKA_P(object_intern, zconsumer);
-
- if (!oconsumer->rk) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\KafkaConsumer::__construct() has not been called");
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\KafkaConsumer::__construct() has not been called");
- return NULL;
- }
-
-@@ -134,19 +127,19 @@ PHP_METHOD(RdKafka__KafkaConsumer, __construct)
- kafka_conf_object *conf_intern;
- rd_kafka_conf_t *conf = NULL;
-
-- zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
-+ zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zconf, ce_kafka_conf) == FAILURE) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zconf, ce_kafka_conf) == FAILURE) {
-+ zend_restore_error_handling(&error_handling);
- return;
- }
-
-- intern = get_custom_object_zval(object_intern, getThis());
-+ intern = Z_RDKAFKA_P(object_intern, getThis());
-
-- conf_intern = get_kafka_conf_object(zconf TSRMLS_CC);
-+ conf_intern = get_kafka_conf_object(zconf);
- if (conf_intern) {
- conf = rd_kafka_conf_dup(conf_intern->u.conf);
-- kafka_conf_callbacks_copy(&intern->cbs, &conf_intern->cbs TSRMLS_CC);
-+ kafka_conf_callbacks_copy(&intern->cbs, &conf_intern->cbs);
- intern->cbs.zrk = *getThis();
- rd_kafka_conf_set_opaque(conf, &intern->cbs);
- }
-@@ -155,15 +148,15 @@ PHP_METHOD(RdKafka__KafkaConsumer, __construct)
- if (conf) {
- rd_kafka_conf_destroy(conf);
- }
-- zend_throw_exception(ce_kafka_exception, "\"group.id\" must be configured", 0 TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "\"group.id\" must be configured", 0);
- return;
- }
-
- rk = rd_kafka_new(RD_KAFKA_CONSUMER, conf, errstr, sizeof(errstr));
-
- if (rk == NULL) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-- zend_throw_exception(ce_kafka_exception, errstr, 0 TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
-+ zend_throw_exception(ce_kafka_exception, errstr, 0);
- return;
- }
-
-@@ -175,7 +168,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, __construct)
-
- rd_kafka_poll_set_consumer(rk);
-
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
- }
- /* }}} */
-
-@@ -193,17 +186,17 @@ PHP_METHOD(RdKafka__KafkaConsumer, assign)
- rd_kafka_resp_err_t err;
- object_intern *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!", &htopars) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|h!", &htopars) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (htopars) {
-- topics = array_arg_to_kafka_topic_partition_list(1, htopars TSRMLS_CC);
-+ topics = array_arg_to_kafka_topic_partition_list(1, htopars);
- if (!topics) {
- return;
- }
-@@ -218,7 +211,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, assign)
- }
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -236,11 +229,11 @@ PHP_METHOD(RdKafka__KafkaConsumer, getAssignment)
- rd_kafka_topic_partition_list_t *topics;
- object_intern *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -248,11 +241,11 @@ PHP_METHOD(RdKafka__KafkaConsumer, getAssignment)
- err = rd_kafka_assignment(intern->rk, &topics);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-- kafka_topic_partition_list_to_array(return_value, topics TSRMLS_CC);
-+ kafka_topic_partition_list_to_array(return_value, topics);
- rd_kafka_topic_partition_list_destroy(topics);
- }
- /* }}} */
-@@ -271,13 +264,13 @@ PHP_METHOD(RdKafka__KafkaConsumer, subscribe)
- object_intern *intern;
- rd_kafka_topic_partition_list_t *topics;
- rd_kafka_resp_err_t err;
-- zeval *zv;
-+ zval *zv;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "h", &htopics) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "h", &htopics) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -285,10 +278,10 @@ PHP_METHOD(RdKafka__KafkaConsumer, subscribe)
- topics = rd_kafka_topic_partition_list_new(zend_hash_num_elements(htopics));
-
- for (zend_hash_internal_pointer_reset_ex(htopics, &pos);
-- (zv = rdkafka_hash_get_current_data_ex(htopics, &pos)) != NULL;
-+ (zv = zend_hash_get_current_data_ex(htopics, &pos)) != NULL;
- zend_hash_move_forward_ex(htopics, &pos)) {
- convert_to_string_ex(zv);
-- rd_kafka_topic_partition_list_add(topics, Z_STRVAL_P(ZEVAL(zv)), RD_KAFKA_PARTITION_UA);
-+ rd_kafka_topic_partition_list_add(topics, Z_STRVAL_P(zv), RD_KAFKA_PARTITION_UA);
- }
-
- err = rd_kafka_subscribe(intern->rk, topics);
-@@ -296,7 +289,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, subscribe)
- rd_kafka_topic_partition_list_destroy(topics);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -315,11 +308,11 @@ PHP_METHOD(RdKafka__KafkaConsumer, getSubscription)
- object_intern *intern;
- int i;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -327,14 +320,14 @@ PHP_METHOD(RdKafka__KafkaConsumer, getSubscription)
- err = rd_kafka_subscription(intern->rk, &topics);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
- array_init_size(return_value, topics->cnt);
-
- for (i = 0; i < topics->cnt; i++) {
-- add_next_index_string(return_value, topics->elems[i].topic ZEVAL_DUP_CC);
-+ add_next_index_string(return_value, topics->elems[i].topic);
- }
-
- rd_kafka_topic_partition_list_destroy(topics);
-@@ -352,11 +345,11 @@ PHP_METHOD(RdKafka__KafkaConsumer, unsubscribe)
- object_intern *intern;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -364,7 +357,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, unsubscribe)
- err = rd_kafka_unsubscribe(intern->rk);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -383,11 +376,11 @@ PHP_METHOD(RdKafka__KafkaConsumer, consume)
- zend_long timeout_ms;
- rd_kafka_message_t *rkmessage, rkmessage_tmp = {0};
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -399,7 +392,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, consume)
- rkmessage = &rkmessage_tmp;
- }
-
-- kafka_message_new(return_value, rkmessage TSRMLS_CC);
-+ kafka_message_new(return_value, rkmessage);
-
- if (rkmessage != &rkmessage_tmp) {
- rd_kafka_message_destroy(rkmessage);
-@@ -414,44 +407,44 @@ static void consumer_commit(int async, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
- rd_kafka_topic_partition_list_t *offsets = NULL;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!", &zarg) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z!", &zarg) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (zarg) {
-- if (Z_TYPE_P(zarg) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zarg), ce_kafka_message TSRMLS_CC)) {
-+ if (Z_TYPE_P(zarg) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zarg), ce_kafka_message)) {
- zval *zerr;
- zval *ztopic;
- zval *zpartition;
- zval *zoffset;
- rd_kafka_topic_partition_t *rktpar;
-
-- zerr = rdkafka_read_property(NULL, zarg, ZEND_STRL("err"), 0 TSRMLS_CC);
-+ zerr = rdkafka_read_property(NULL, Z_RDKAFKA_PROP_OBJ(zarg), ZEND_STRL("err"), 0);
- if (zerr && Z_TYPE_P(zerr) != IS_NULL && (Z_TYPE_P(zerr) != IS_LONG || Z_LVAL_P(zerr) != RD_KAFKA_RESP_ERR_NO_ERROR)) {
-- zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message has an error", RD_KAFKA_RESP_ERR__INVALID_ARG TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message has an error", RD_KAFKA_RESP_ERR__INVALID_ARG);
- return;
- }
-
-- ztopic = rdkafka_read_property(NULL, zarg, ZEND_STRL("topic_name"), 0 TSRMLS_CC);
-+ ztopic = rdkafka_read_property(NULL, Z_RDKAFKA_PROP_OBJ(zarg), ZEND_STRL("topic_name"), 0);
- if (!ztopic || Z_TYPE_P(ztopic) != IS_STRING) {
-- zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message's topic_name is not a string", RD_KAFKA_RESP_ERR__INVALID_ARG TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message's topic_name is not a string", RD_KAFKA_RESP_ERR__INVALID_ARG);
- return;
- }
-
-- zpartition = rdkafka_read_property(NULL, zarg, ZEND_STRL("partition"), 0 TSRMLS_CC);
-+ zpartition = rdkafka_read_property(NULL, Z_RDKAFKA_PROP_OBJ(zarg), ZEND_STRL("partition"), 0);
- if (!zpartition || Z_TYPE_P(zpartition) != IS_LONG) {
-- zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message's partition is not an int", RD_KAFKA_RESP_ERR__INVALID_ARG TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message's partition is not an int", RD_KAFKA_RESP_ERR__INVALID_ARG);
- return;
- }
-
-- zoffset = rdkafka_read_property(NULL, zarg, ZEND_STRL("offset"), 0 TSRMLS_CC);
-+ zoffset = rdkafka_read_property(NULL, Z_RDKAFKA_PROP_OBJ(zarg), ZEND_STRL("offset"), 0);
- if (!zoffset || Z_TYPE_P(zoffset) != IS_LONG) {
-- zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message's offset is not an int", RD_KAFKA_RESP_ERR__INVALID_ARG TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "Invalid argument: Specified Message's offset is not an int", RD_KAFKA_RESP_ERR__INVALID_ARG);
- return;
- }
-
-@@ -463,14 +456,14 @@ static void consumer_commit(int async, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
-
- } else if (Z_TYPE_P(zarg) == IS_ARRAY) {
- HashTable *ary = Z_ARRVAL_P(zarg);
-- offsets = array_arg_to_kafka_topic_partition_list(1, ary TSRMLS_CC);
-+ offsets = array_arg_to_kafka_topic_partition_list(1, ary);
- if (!offsets) {
- return;
- }
- } else if (Z_TYPE_P(zarg) != IS_NULL) {
- php_error(E_ERROR,
- "RdKafka\\KafkaConsumer::%s() expects parameter %d to be %s, %s given",
-- get_active_function_name(TSRMLS_C),
-+ get_active_function_name(),
- 1,
- "an instance of RdKafka\\Message or an array of RdKafka\\TopicPartition",
- zend_zval_type_name(zarg));
-@@ -485,7 +478,7 @@ static void consumer_commit(int async, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
- }
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -527,7 +520,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, close)
- {
- object_intern *intern;
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -555,17 +548,17 @@ PHP_METHOD(RdKafka__KafkaConsumer, getMetadata)
- const rd_kafka_metadata_t *metadata;
- kafka_topic_object *only_orkt = NULL;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bO!l", &all_topics, &only_zrkt, ce_kafka_topic, &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "bO!l", &all_topics, &only_zrkt, ce_kafka_topic, &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (only_zrkt) {
-- only_orkt = get_kafka_topic_object(only_zrkt TSRMLS_CC);
-+ only_orkt = get_kafka_topic_object(only_zrkt);
- if (!only_orkt) {
- return;
- }
-@@ -574,11 +567,11 @@ PHP_METHOD(RdKafka__KafkaConsumer, getMetadata)
- err = rd_kafka_metadata(intern->rk, all_topics, only_orkt ? only_orkt->rkt : NULL, &metadata, timeout_ms);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-- kafka_metadata_init(return_value, metadata TSRMLS_CC);
-+ kafka_metadata_init(return_value, metadata);
- }
- /* }}} */
-
-@@ -593,7 +586,7 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__KafkaConsumer, newTopic)
- {
- char *topic;
-- arglen_t topic_len;
-+ size_t topic_len;
- rd_kafka_topic_t *rkt;
- object_intern *intern;
- kafka_topic_object *topic_intern;
-@@ -601,17 +594,17 @@ PHP_METHOD(RdKafka__KafkaConsumer, newTopic)
- rd_kafka_topic_conf_t *conf = NULL;
- kafka_conf_object *conf_intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|O!", &topic, &topic_len, &zconf, ce_kafka_topic_conf) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|O!", &topic, &topic_len, &zconf, ce_kafka_topic_conf) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (zconf) {
-- conf_intern = get_kafka_conf_object(zconf TSRMLS_CC);
-+ conf_intern = get_kafka_conf_object(zconf);
- if (conf_intern) {
- conf = rd_kafka_topic_conf_dup(conf_intern->u.topic_conf);
- }
-@@ -627,7 +620,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, newTopic)
- return;
- }
-
-- topic_intern = get_custom_object_zval(kafka_topic_object, return_value);
-+ topic_intern = Z_RDKAFKA_P(kafka_topic_object, return_value);
- if (!topic_intern) {
- return;
- }
-@@ -652,16 +645,16 @@ PHP_METHOD(RdKafka__KafkaConsumer, getCommittedOffsets)
- rd_kafka_resp_err_t err;
- rd_kafka_topic_partition_list_t *topics;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "hl", &htopars, &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "hl", &htopars, &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- topics = array_arg_to_kafka_topic_partition_list(1, htopars TSRMLS_CC);
-+ topics = array_arg_to_kafka_topic_partition_list(1, htopars);
- if (!topics) {
- return;
- }
-@@ -670,10 +663,10 @@ PHP_METHOD(RdKafka__KafkaConsumer, getCommittedOffsets)
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
- rd_kafka_topic_partition_list_destroy(topics);
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-- kafka_topic_partition_list_to_array(return_value, topics TSRMLS_CC);
-+ kafka_topic_partition_list_to_array(return_value, topics);
- rd_kafka_topic_partition_list_destroy(topics);
- }
- /* }}} */
-@@ -694,16 +687,16 @@ PHP_METHOD(RdKafka__KafkaConsumer, getOffsetPositions)
- rd_kafka_resp_err_t err;
- rd_kafka_topic_partition_list_t *topics;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "h", &htopars) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "h", &htopars) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- topics = array_arg_to_kafka_topic_partition_list(1, htopars TSRMLS_CC);
-+ topics = array_arg_to_kafka_topic_partition_list(1, htopars);
- if (!topics) {
- return;
- }
-@@ -712,10 +705,10 @@ PHP_METHOD(RdKafka__KafkaConsumer, getOffsetPositions)
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
- rd_kafka_topic_partition_list_destroy(topics);
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-- kafka_topic_partition_list_to_array(return_value, topics TSRMLS_CC);
-+ kafka_topic_partition_list_to_array(return_value, topics);
- rd_kafka_topic_partition_list_destroy(topics);
- }
- /* }}} */
-@@ -734,16 +727,16 @@ PHP_METHOD(RdKafka__KafkaConsumer, offsetsForTimes)
- zend_long timeout_ms;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "hl", &htopars, &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "hl", &htopars, &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- topicPartitions = array_arg_to_kafka_topic_partition_list(1, htopars TSRMLS_CC);
-+ topicPartitions = array_arg_to_kafka_topic_partition_list(1, htopars);
- if (!topicPartitions) {
- return;
- }
-@@ -752,10 +745,10 @@ PHP_METHOD(RdKafka__KafkaConsumer, offsetsForTimes)
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
- rd_kafka_topic_partition_list_destroy(topicPartitions);
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-- kafka_topic_partition_list_to_array(return_value, topicPartitions TSRMLS_CC);
-+ kafka_topic_partition_list_to_array(return_value, topicPartitions);
- rd_kafka_topic_partition_list_destroy(topicPartitions);
- }
- /* }}} */
-@@ -775,20 +768,20 @@ PHP_METHOD(RdKafka__KafkaConsumer, queryWatermarkOffsets)
- {
- object_intern *intern;
- char *topic;
-- arglen_t topic_length;
-+ size_t topic_length;
- long low, high;
- zend_long partition, timeout;
- zval *lowResult, *highResult;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "slzzl", &topic, &topic_length, &partition, &lowResult, &highResult, &timeout) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "slzzl", &topic, &topic_length, &partition, &lowResult, &highResult, &timeout) == FAILURE) {
- return;
- }
-
-- ZEVAL_DEREF(lowResult);
-- ZEVAL_DEREF(highResult);
-+ ZVAL_DEREF(lowResult);
-+ ZVAL_DEREF(highResult);
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -796,7 +789,7 @@ PHP_METHOD(RdKafka__KafkaConsumer, queryWatermarkOffsets)
- err = rd_kafka_query_watermark_offsets(intern->rk, topic, partition, &low, &high, timeout);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-@@ -825,19 +818,19 @@ static const zend_function_entry fe[] = { /* {{{ */
- PHP_FE_END
- }; /* }}} */
-
--void kafka_kafka_consumer_minit(TSRMLS_D) /* {{{ */
-+void kafka_kafka_consumer_minit(INIT_FUNC_ARGS) /* {{{ */
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "KafkaConsumer", fe);
-- ce = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce = zend_register_internal_class(&tmpce);
- ce->create_object = kafka_consumer_new;
-
- handlers = kafka_default_object_handlers;
-- set_object_handler_free_obj(&handlers, kafka_consumer_free);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = kafka_consumer_free;
-+ handlers.offset = XtOffsetOf(object_intern, std);
-
-- zend_declare_property_null(ce, ZEND_STRL("error_cb"), ZEND_ACC_PRIVATE TSRMLS_CC);
-- zend_declare_property_null(ce, ZEND_STRL("rebalance_cb"), ZEND_ACC_PRIVATE TSRMLS_CC);
-- zend_declare_property_null(ce, ZEND_STRL("dr_msg_cb"), ZEND_ACC_PRIVATE TSRMLS_CC);
-+ zend_declare_property_null(ce, ZEND_STRL("error_cb"), ZEND_ACC_PRIVATE);
-+ zend_declare_property_null(ce, ZEND_STRL("rebalance_cb"), ZEND_ACC_PRIVATE);
-+ zend_declare_property_null(ce, ZEND_STRL("dr_msg_cb"), ZEND_ACC_PRIVATE);
- } /* }}} */
-diff --git a/kafka_consumer.h b/kafka_consumer.h
-index 6e86784..cc4be66 100644
---- a/kafka_consumer.h
-+++ b/kafka_consumer.h
-@@ -16,4 +16,4 @@
- +----------------------------------------------------------------------+
- */
-
--void kafka_kafka_consumer_minit(TSRMLS_D);
-+void kafka_kafka_consumer_minit(INIT_FUNC_ARGS);
-diff --git a/kafka_error_exception.c b/kafka_error_exception.c
-index a19527a..19b881c 100644
---- a/kafka_error_exception.c
-+++ b/kafka_error_exception.c
-@@ -27,20 +27,19 @@
- #include "Zend/zend_interfaces.h"
- #include "Zend/zend_exceptions.h"
- #include "kafka_error_exception.h"
--#include "zeval.h"
-
- zend_class_entry * ce_kafka_error;
-
--void create_kafka_error(zval *return_value, const rd_kafka_error_t *error TSRMLS_DC) /* {{{ */
-+void create_kafka_error(zval *return_value, const rd_kafka_error_t *error) /* {{{ */
- {
- object_init_ex(return_value, ce_kafka_error);
-
-- zend_update_property_string(ce_kafka_error, return_value, ZEND_STRL("message"), rd_kafka_error_name(error) TSRMLS_CC);
-- zend_update_property_long(ce_kafka_error, return_value, ZEND_STRL("code"), rd_kafka_error_code(error) TSRMLS_CC);
-- zend_update_property_string(ce_kafka_error, return_value, ZEND_STRL("error_string"), rd_kafka_error_string(error) TSRMLS_CC);
-- zend_update_property_bool(ce_kafka_error, return_value, ZEND_STRL("isFatal"), rd_kafka_error_is_fatal(error) TSRMLS_CC);
-- zend_update_property_bool(ce_kafka_error, return_value, ZEND_STRL("isRetriable"), rd_kafka_error_is_retriable(error) TSRMLS_CC);
-- zend_update_property_bool(ce_kafka_error, return_value, ZEND_STRL("transactionRequiresAbort"), rd_kafka_error_txn_requires_abort(error) TSRMLS_CC);
-+ zend_update_property_string(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("message"), rd_kafka_error_name(error));
-+ zend_update_property_long(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("code"), rd_kafka_error_code(error));
-+ zend_update_property_string(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("error_string"), rd_kafka_error_string(error));
-+ zend_update_property_bool(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("isFatal"), rd_kafka_error_is_fatal(error));
-+ zend_update_property_bool(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("isRetriable"), rd_kafka_error_is_retriable(error));
-+ zend_update_property_bool(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("transactionRequiresAbort"), rd_kafka_error_txn_requires_abort(error));
-
- Z_ADDREF_P(return_value);
- }
-@@ -59,20 +58,20 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__KafkaErrorException, __construct)
- {
- char *message, *error_string = "";
-- arglen_t message_length = 0, error_string_length = 0;
-+ size_t message_length = 0, error_string_length = 0;
- zend_bool isFatal = 0, isRetriable = 0, transactionRequiresAbort = 0;
- zend_long code = 0;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|sbbb", &message, &message_length, &code, &error_string, &error_string_length, &isFatal, &isRetriable, &transactionRequiresAbort) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|sbbb", &message, &message_length, &code, &error_string, &error_string_length, &isFatal, &isRetriable, &transactionRequiresAbort) == FAILURE) {
- return;
- }
-
-- zend_update_property_string(ce_kafka_error, getThis(), ZEND_STRL("message"), message TSRMLS_CC);
-- zend_update_property_long(ce_kafka_error, getThis(), ZEND_STRL("code"), code TSRMLS_CC);
-- zend_update_property_string(ce_kafka_error, getThis(), ZEND_STRL("error_string"), error_string TSRMLS_CC);
-- zend_update_property_bool(ce_kafka_error, getThis(), ZEND_STRL("isFatal"), isFatal TSRMLS_CC);
-- zend_update_property_bool(ce_kafka_error, getThis(), ZEND_STRL("isRetriable"), isRetriable TSRMLS_CC);
-- zend_update_property_bool(ce_kafka_error, getThis(), ZEND_STRL("transactionRequiresAbort"), transactionRequiresAbort TSRMLS_CC);
-+ zend_update_property_string(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("message"), message);
-+ zend_update_property_long(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("code"), code);
-+ zend_update_property_string(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("error_string"), error_string);
-+ zend_update_property_bool(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("isFatal"), isFatal);
-+ zend_update_property_bool(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("isRetriable"), isRetriable);
-+ zend_update_property_bool(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("transactionRequiresAbort"), transactionRequiresAbort);
- }
- /* }}} */
-
-@@ -86,22 +85,18 @@ PHP_METHOD(RdKafka__KafkaErrorException, getErrorString)
- {
- zval *res;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- res = rdkafka_read_property(ce_kafka_error, getThis(), ZEND_STRL("error_string"), 0 TSRMLS_CC);
-+ res = rdkafka_read_property(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("error_string"), 0);
-
- if (!res || Z_TYPE_P(res) != IS_STRING) {
- return;
- }
-
--#if PHP_MAJOR_VERSION >= 7
- ZVAL_DEREF(res);
- ZVAL_COPY(return_value, res);
--#else
-- RETURN_ZVAL(res, 1, 0)
--#endif
- }
- /* }}} */
-
-@@ -116,22 +111,18 @@ PHP_METHOD(RdKafka__KafkaErrorException, isFatal)
- {
- zval *res;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- res = rdkafka_read_property(ce_kafka_error, getThis(), ZEND_STRL("isFatal"), 0 TSRMLS_CC);
-+ res = rdkafka_read_property(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("isFatal"), 0);
-
--#if PHP_MAJOR_VERSION >= 7
- if (!res || (Z_TYPE_P(res) != IS_TRUE && Z_TYPE_P(res) != IS_FALSE)) {
- return;
- }
-
- ZVAL_DEREF(res);
- ZVAL_COPY(return_value, res);
--#else
-- RETURN_ZVAL(res, 1, 0)
--#endif
- }
- /* }}} */
-
-@@ -145,22 +136,18 @@ PHP_METHOD(RdKafka__KafkaErrorException, isRetriable)
- {
- zval *res;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- res = rdkafka_read_property(ce_kafka_error, getThis(), ZEND_STRL("isRetriable"), 0 TSRMLS_CC);
-+ res = rdkafka_read_property(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("isRetriable"), 0);
-
--#if PHP_MAJOR_VERSION >= 7
- if (!res || (Z_TYPE_P(res) != IS_TRUE && Z_TYPE_P(res) != IS_FALSE)) {
- return;
- }
-
- ZVAL_DEREF(res);
- ZVAL_COPY(return_value, res);
--#else
-- RETURN_ZVAL(res, 1, 0)
--#endif
- }
- /* }}} */
-
-@@ -174,22 +161,18 @@ PHP_METHOD(RdKafka__KafkaErrorException, transactionRequiresAbort)
- {
- zval *res;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- res = rdkafka_read_property(ce_kafka_error, getThis(), ZEND_STRL("transactionRequiresAbort"), 0 TSRMLS_CC);
-+ res = rdkafka_read_property(ce_kafka_error, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("transactionRequiresAbort"), 0);
-
--#if PHP_MAJOR_VERSION >= 7
- if (!res || (Z_TYPE_P(res) != IS_TRUE && Z_TYPE_P(res) != IS_FALSE)) {
- return;
- }
-
- ZVAL_DEREF(res);
- ZVAL_COPY(return_value, res);
--#else
-- RETURN_ZVAL(res, 1, 0)
--#endif
- }
- /* }}} */
-
-@@ -202,17 +185,17 @@ static const zend_function_entry kafka_error_fe[] = { /* {{{ */
- PHP_FE_END
- }; /* }}} */
-
--void kafka_error_minit(TSRMLS_D) /* {{{ */
-+void kafka_error_minit() /* {{{ */
- {
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "KafkaErrorException", kafka_error_fe);
-- ce_kafka_error = rdkafka_register_internal_class_ex(&ce, ce_kafka_exception TSRMLS_CC);
-+ ce_kafka_error = zend_register_internal_class_ex(&ce, ce_kafka_exception);
-
-- zend_declare_property_null(ce_kafka_error, ZEND_STRL("error_string"), ZEND_ACC_PRIVATE TSRMLS_CC);
-- zend_declare_property_bool(ce_kafka_error, ZEND_STRL("isFatal"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
-- zend_declare_property_bool(ce_kafka_error, ZEND_STRL("isRetriable"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
-- zend_declare_property_bool(ce_kafka_error, ZEND_STRL("transactionRequiresAbort"), 0, ZEND_ACC_PRIVATE TSRMLS_CC);
-+ zend_declare_property_null(ce_kafka_error, ZEND_STRL("error_string"), ZEND_ACC_PRIVATE);
-+ zend_declare_property_bool(ce_kafka_error, ZEND_STRL("isFatal"), 0, ZEND_ACC_PRIVATE);
-+ zend_declare_property_bool(ce_kafka_error, ZEND_STRL("isRetriable"), 0, ZEND_ACC_PRIVATE);
-+ zend_declare_property_bool(ce_kafka_error, ZEND_STRL("transactionRequiresAbort"), 0, ZEND_ACC_PRIVATE);
- } /* }}} */
- #endif
-
-diff --git a/kafka_error_exception.h b/kafka_error_exception.h
-index 71ad2f3..d44b895 100644
---- a/kafka_error_exception.h
-+++ b/kafka_error_exception.h
-@@ -15,11 +15,13 @@
- | Author: Arnaud Le Blanc <arnaud.lb@gmail.com> |
- +----------------------------------------------------------------------+
- */
-+
- #ifdef HAS_RD_KAFKA_TRANSACTIONS
-
--#include "zeval.h"
- #include "librdkafka/rdkafka.h"
-+#include "Zend/zend_interfaces.h"
-+
- extern zend_class_entry * ce_kafka_error;
--void kafka_error_minit(TSRMLS_D);
--void create_kafka_error(zval *return_value, const rd_kafka_error_t *error TSRMLS_DC);
-+void kafka_error_minit();
-+void create_kafka_error(zval *return_value, const rd_kafka_error_t *error);
- #endif
-diff --git a/message.c b/message.c
-index d8b7dc3..f4c4c7f 100644
---- a/message.c
-+++ b/message.c
-@@ -32,7 +32,7 @@
-
- zend_class_entry * ce_kafka_message;
-
--void kafka_message_new(zval *return_value, const rd_kafka_message_t *message TSRMLS_DC)
-+void kafka_message_new(zval *return_value, const rd_kafka_message_t *message)
- {
- object_init_ex(return_value, ce_kafka_message);
-
-@@ -48,24 +48,24 @@ void kafka_message_new(zval *return_value, const rd_kafka_message_t *message TSR
- const void *header_value = NULL;
- size_t header_size = 0;
- zval headers_array;
-- size_t i;
-+ uint i;
- #endif /* HAVE_RD_KAFKA_MESSAGE_HEADERS */
-
-- zend_update_property_long(NULL, return_value, ZEND_STRL("err"), message->err TSRMLS_CC);
-+ zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("err"), message->err);
-
- if (message->rkt) {
-- zend_update_property_string(NULL, return_value, ZEND_STRL("topic_name"), rd_kafka_topic_name(message->rkt) TSRMLS_CC);
-+ zend_update_property_string(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("topic_name"), rd_kafka_topic_name(message->rkt));
- }
-- zend_update_property_long(NULL, return_value, ZEND_STRL("partition"), message->partition TSRMLS_CC);
-+ zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("partition"), message->partition);
- if (message->payload) {
-- zend_update_property_long(NULL, return_value, ZEND_STRL("timestamp"), timestamp TSRMLS_CC);
-- zend_update_property_stringl(NULL, return_value, ZEND_STRL("payload"), message->payload, message->len TSRMLS_CC);
-- zend_update_property_long(NULL, return_value, ZEND_STRL("len"), message->len TSRMLS_CC);
-+ zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("timestamp"), timestamp);
-+ zend_update_property_stringl(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("payload"), message->payload, message->len);
-+ zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("len"), message->len);
- }
- if (message->key) {
-- zend_update_property_stringl(NULL, return_value, ZEND_STRL("key"), message->key, message->key_len TSRMLS_CC);
-+ zend_update_property_stringl(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("key"), message->key, message->key_len);
- }
-- zend_update_property_long(NULL, return_value, ZEND_STRL("offset"), message->offset TSRMLS_CC);
-+ zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("offset"), message->offset);
-
- #ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS
- if (message->err == RD_KAFKA_RESP_ERR_NO_ERROR) {
-@@ -77,28 +77,28 @@ void kafka_message_new(zval *return_value, const rd_kafka_message_t *message TSR
- if (header_response != RD_KAFKA_RESP_ERR_NO_ERROR) {
- break;
- }
-- rdkafka_add_assoc_stringl(&headers_array, header_name, (const char*)header_value, header_size);
-+ add_assoc_stringl(&headers_array, header_name, (const char*)header_value, header_size);
- }
-- zend_update_property(NULL, return_value, ZEND_STRL("headers"), &headers_array TSRMLS_CC);
-+ zend_update_property(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("headers"), &headers_array);
- zval_ptr_dtor(&headers_array);
- }
- }
- #endif
- }
-
--void kafka_message_list_to_array(zval *return_value, rd_kafka_message_t **messages, long size TSRMLS_DC) /* {{{ */
-+void kafka_message_list_to_array(zval *return_value, rd_kafka_message_t **messages, long size) /* {{{ */
- {
- rd_kafka_message_t *msg;
-- zeval zmsg;
-+ zval zmsg;
- int i;
-
- array_init_size(return_value, size);
-
- for (i = 0; i < size; i++) {
- msg = messages[i];
-- MAKE_STD_ZEVAL(zmsg);
-- kafka_message_new(P_ZEVAL(zmsg), msg TSRMLS_CC);
-- add_next_index_zval(return_value, P_ZEVAL(zmsg));
-+ ZVAL_NULL(&zmsg);
-+ kafka_message_new(&zmsg, msg);
-+ add_next_index_zval(return_value, &zmsg);
- }
- } /* }}} */
-
-@@ -115,11 +115,11 @@ PHP_METHOD(RdKafka__Message, errstr)
- zval *zpayload;
- const char *errstr;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- zerr = rdkafka_read_property(NULL, getThis(), ZEND_STRL("err"), 0 TSRMLS_CC);
-+ zerr = rdkafka_read_property(NULL, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("err"), 0);
-
- if (!zerr || Z_TYPE_P(zerr) != IS_LONG) {
- return;
-@@ -128,10 +128,10 @@ PHP_METHOD(RdKafka__Message, errstr)
- errstr = rd_kafka_err2str(Z_LVAL_P(zerr));
-
- if (errstr) {
-- RDKAFKA_RETURN_STRING(errstr);
-+ RETURN_STRING(errstr);
- }
-
-- zpayload = rdkafka_read_property(NULL, getThis(), ZEND_STRL("payload"), 0 TSRMLS_CC);
-+ zpayload = rdkafka_read_property(NULL, Z_RDKAFKA_PROP_OBJ(getThis()), ZEND_STRL("payload"), 0);
-
- if (zpayload && Z_TYPE_P(zpayload) == IS_STRING) {
- RETURN_ZVAL(zpayload, 1, 0);
-@@ -144,21 +144,21 @@ static const zend_function_entry kafka_message_fe[] = {
- PHP_FE_END
- };
-
--void kafka_message_minit(TSRMLS_D) { /* {{{ */
-+void kafka_message_minit(INIT_FUNC_ARGS) { /* {{{ */
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Message", kafka_message_fe);
-- ce_kafka_message = zend_register_internal_class(&ce TSRMLS_CC);
--
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("err"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("topic_name"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("timestamp"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("partition"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("payload"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("len"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("key"), ZEND_ACC_PUBLIC TSRMLS_CC);
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("offset"), ZEND_ACC_PUBLIC TSRMLS_CC);
-+ ce_kafka_message = zend_register_internal_class(&ce);
-+
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("err"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("topic_name"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("timestamp"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("partition"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("payload"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("len"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("key"), ZEND_ACC_PUBLIC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("offset"), ZEND_ACC_PUBLIC);
- #ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS
-- zend_declare_property_null(ce_kafka_message, ZEND_STRL("headers"), ZEND_ACC_PUBLIC TSRMLS_CC);
-+ zend_declare_property_null(ce_kafka_message, ZEND_STRL("headers"), ZEND_ACC_PUBLIC);
- #endif
- } /* }}} */
-diff --git a/message.h b/message.h
-index 28d75fb..3a0f701 100644
---- a/message.h
-+++ b/message.h
-@@ -16,8 +16,8 @@
- +----------------------------------------------------------------------+
- */
-
--void kafka_message_minit(TSRMLS_D);
--void kafka_message_new(zval *return_value, const rd_kafka_message_t *message TSRMLS_DC);
--void kafka_message_list_to_array(zval *return_value, rd_kafka_message_t **messages, long size TSRMLS_DC);
-+void kafka_message_minit(INIT_FUNC_ARGS);
-+void kafka_message_new(zval *return_value, const rd_kafka_message_t *message);
-+void kafka_message_list_to_array(zval *return_value, rd_kafka_message_t **messages, long size);
-
- extern zend_class_entry * ce_kafka_message;
-diff --git a/metadata.c b/metadata.c
-index e8baca7..4d3f12d 100644
---- a/metadata.c
-+++ b/metadata.c
-@@ -29,101 +29,93 @@
- #include "metadata_broker.h"
- #include "metadata_partition.h"
- #include "Zend/zend_exceptions.h"
--#include "zeval.h"
-
- typedef struct _object_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- const rd_kafka_metadata_t *metadata;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } object_intern;
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC);
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp);
-
- static zend_class_entry * ce;
- static zend_object_handlers handlers;
-
--static void brokers_collection(zval *return_value, zval *parent, object_intern *intern TSRMLS_DC) { /* {{{ */
-- kafka_metadata_collection_init(return_value, parent, intern->metadata->brokers, intern->metadata->broker_cnt, sizeof(*intern->metadata->brokers), kafka_metadata_broker_ctor TSRMLS_CC);
-+static void brokers_collection(zval *return_value, Z_RDKAFKA_OBJ *parent, object_intern *intern) { /* {{{ */
-+ kafka_metadata_collection_init(return_value, parent, intern->metadata->brokers, intern->metadata->broker_cnt, sizeof(*intern->metadata->brokers), kafka_metadata_broker_ctor);
- }
- /* }}} */
-
--static void topics_collection(zval *return_value, zval *parent, object_intern *intern TSRMLS_DC) { /* {{{ */
-- kafka_metadata_collection_init(return_value, parent, intern->metadata->topics, intern->metadata->topic_cnt, sizeof(*intern->metadata->topics), kafka_metadata_topic_ctor TSRMLS_CC);
-+static void topics_collection(zval *return_value, Z_RDKAFKA_OBJ *parent, object_intern *intern) { /* {{{ */
-+ kafka_metadata_collection_init(return_value, parent, intern->metadata->topics, intern->metadata->topic_cnt, sizeof(*intern->metadata->topics), kafka_metadata_topic_ctor);
- }
- /* }}} */
-
--static void kafka_metadata_free(zend_object *object TSRMLS_DC) /* {{{ */
-+static void kafka_metadata_free(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
-
- if (intern->metadata) {
- rd_kafka_metadata_destroy(intern->metadata);
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value kafka_metadata_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *kafka_metadata_new(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, kafka_metadata_free, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *zmetadata TSRMLS_DC)
-+static object_intern * get_object(zval *zmetadata)
- {
-- object_intern *ometadata = get_custom_object_zval(object_intern, zmetadata);
-+ object_intern *ometadata = Z_RDKAFKA_P(object_intern, zmetadata);
-
- if (!ometadata->metadata) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Metadata::__construct() has not been called");
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Metadata::__construct() has not been called");
- return NULL;
- }
-
- return ometadata;
- }
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */
- {
- zval ary;
- object_intern *intern;
-- zeval brokers;
-- zeval topics;
-+ zval brokers;
-+ zval topics;
-
- *is_temp = 1;
-
- array_init(&ary);
-
-- intern = get_object(object TSRMLS_CC);
-+ intern = rdkafka_get_debug_object(object_intern, object);
- if (!intern) {
- return Z_ARRVAL(ary);
- }
-
-- MAKE_STD_ZEVAL(brokers);
-- brokers_collection(P_ZEVAL(brokers), object, intern TSRMLS_CC);
-- add_assoc_zval(&ary, "brokers", P_ZEVAL(brokers));
-+ ZVAL_NULL(&brokers);
-+ brokers_collection(&brokers, object, intern);
-+ add_assoc_zval(&ary, "brokers", &brokers);
-
-- MAKE_STD_ZEVAL(topics);
-- topics_collection(P_ZEVAL(topics), object, intern TSRMLS_CC);
-- add_assoc_zval(&ary, "topics", P_ZEVAL(topics));
-+ ZVAL_NULL(&topics);
-+ topics_collection(&topics, object, intern);
-+ add_assoc_zval(&ary, "topics", &topics);
-
- add_assoc_long(&ary, "orig_broker_id", intern->metadata->orig_broker_id);
-- rdkafka_add_assoc_string(&ary, "orig_broker_name", intern->metadata->orig_broker_name);
-+ add_assoc_string(&ary, "orig_broker_name", intern->metadata->orig_broker_name);
-
- return Z_ARRVAL(ary);
- }
-@@ -143,7 +135,7 @@ PHP_METHOD(RdKafka__Metadata, getOrigBrokerId)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -166,12 +158,12 @@ PHP_METHOD(RdKafka__Metadata, getOrigBrokerName)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- RDKAFKA_RETURN_STRING(intern->metadata->orig_broker_name);
-+ RETURN_STRING(intern->metadata->orig_broker_name);
- }
- /* }}} */
-
-@@ -189,12 +181,12 @@ PHP_METHOD(RdKafka__Metadata, getBrokers)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- brokers_collection(return_value, getThis(), intern TSRMLS_CC);
-+ brokers_collection(return_value, Z_RDKAFKA_PROP_OBJ(getThis()), intern);
- }
- /* }}} */
-
-@@ -212,12 +204,12 @@ PHP_METHOD(RdKafka__Metadata, getTopics)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- topics_collection(return_value, getThis(), intern TSRMLS_CC);
-+ topics_collection(return_value, Z_RDKAFKA_PROP_OBJ(getThis()), intern);
- }
- /* }}} */
-
-@@ -229,26 +221,26 @@ static const zend_function_entry kafka_metadata_fe[] = {
- PHP_FE_END
- };
-
--void kafka_metadata_minit(TSRMLS_D)
-+void kafka_metadata_minit(INIT_FUNC_ARGS)
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "Metadata", kafka_metadata_fe);
-- ce = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce = zend_register_internal_class(&tmpce);
- ce->create_object = kafka_metadata_new;
-
- handlers = kafka_default_object_handlers;
- handlers.get_debug_info = get_debug_info;
-- set_object_handler_free_obj(&handlers, kafka_metadata_free);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = kafka_metadata_free;
-+ handlers.offset = XtOffsetOf(object_intern, std);
-
-- kafka_metadata_topic_minit(TSRMLS_C);
-- kafka_metadata_broker_minit(TSRMLS_C);
-- kafka_metadata_partition_minit(TSRMLS_C);
-- kafka_metadata_collection_minit(TSRMLS_C);
-+ kafka_metadata_topic_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_metadata_broker_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_metadata_partition_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_metadata_collection_minit(INIT_FUNC_ARGS_PASSTHRU);
- }
-
--void kafka_metadata_init(zval *return_value, const rd_kafka_metadata_t *metadata TSRMLS_DC)
-+void kafka_metadata_init(zval *return_value, const rd_kafka_metadata_t *metadata)
- {
- object_intern *intern;
-
-@@ -256,7 +248,7 @@ void kafka_metadata_init(zval *return_value, const rd_kafka_metadata_t *metadata
- return;
- }
-
-- intern = get_custom_object_zval(object_intern, return_value);
-+ intern = Z_RDKAFKA_P(object_intern, return_value);
- if (!intern) {
- return;
- }
-diff --git a/metadata.h b/metadata.h
-index 074816f..d09d2db 100644
---- a/metadata.h
-+++ b/metadata.h
-@@ -16,5 +16,5 @@
- +----------------------------------------------------------------------+
- */
-
--void kafka_metadata_minit(TSRMLS_D);
--void kafka_metadata_init(zval *return_value, const rd_kafka_metadata_t *metadata TSRMLS_DC);
-+void kafka_metadata_minit(INIT_FUNC_ARGS);
-+void kafka_metadata_init(zval *return_value, const rd_kafka_metadata_t *metadata);
-diff --git a/metadata_broker.c b/metadata_broker.c
-index 89655a5..b964231 100644
---- a/metadata_broker.c
-+++ b/metadata_broker.c
-@@ -27,68 +27,59 @@
- #include "ext/spl/spl_iterators.h"
- #include "Zend/zend_interfaces.h"
- #include "Zend/zend_exceptions.h"
--#include "zeval.h"
-
- typedef struct _object_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- zval zmetadata;
- const rd_kafka_metadata_broker_t *metadata_broker;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } object_intern;
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC);
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp);
-
- static zend_class_entry * ce;
- static zend_object_handlers handlers;
-
--static void free_object(zend_object *object TSRMLS_DC) /* {{{ */
-+static void free_object(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
-
- if (intern->metadata_broker) {
- zval_dtor(&intern->zmetadata);
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *create_object(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
--
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_object, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *zmt TSRMLS_DC)
-+static object_intern * get_object(zval *zmt)
- {
-- object_intern *omt = get_custom_object_zval(object_intern, zmt);
-+ object_intern *omt = Z_RDKAFKA_P(object_intern, zmt);
-
- if (!omt->metadata_broker) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Metadata\\Broker::__construct() has not been called");
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Metadata\\Broker::__construct() has not been called");
- return NULL;
- }
-
- return omt;
- }
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */
- {
- zval ary;
- object_intern *intern;
-@@ -97,13 +88,13 @@ static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-
- array_init(&ary);
-
-- intern = get_object(object TSRMLS_CC);
-+ intern = rdkafka_get_debug_object(object_intern, object);
- if (!intern) {
- return Z_ARRVAL(ary);
- }
-
- add_assoc_long(&ary, "id", intern->metadata_broker->id);
-- rdkafka_add_assoc_string(&ary, "host", intern->metadata_broker->host);
-+ add_assoc_string(&ary, "host", intern->metadata_broker->host);
- add_assoc_long(&ary, "port", intern->metadata_broker->port);
-
- return Z_ARRVAL(ary);
-@@ -124,7 +115,7 @@ PHP_METHOD(RdKafka__Metadata__Broker, getId)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -147,12 +138,12 @@ PHP_METHOD(RdKafka__Metadata__Broker, getHost)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- RDKAFKA_RETURN_STRING(intern->metadata_broker->host);
-+ RETURN_STRING(intern->metadata_broker->host);
- }
- /* }}} */
-
-@@ -170,7 +161,7 @@ PHP_METHOD(RdKafka__Metadata__Broker, getPort)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -186,21 +177,21 @@ static const zend_function_entry fe[] = {
- PHP_FE_END
- };
-
--void kafka_metadata_broker_minit(TSRMLS_D)
-+void kafka_metadata_broker_minit(INIT_FUNC_ARGS)
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "Metadata\\Broker", fe);
-- ce = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce = zend_register_internal_class(&tmpce);
- ce->create_object = create_object;
-
- handlers = kafka_default_object_handlers;
- handlers.get_debug_info = get_debug_info;
-- set_object_handler_free_obj(&handlers, free_object);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = free_object;
-+ handlers.offset = XtOffsetOf(object_intern, std);
- }
-
--void kafka_metadata_broker_ctor(zval *return_value, zval *zmetadata, const void *data TSRMLS_DC)
-+void kafka_metadata_broker_ctor(zval *return_value, zval *zmetadata, const void *data)
- {
- rd_kafka_metadata_broker_t *metadata_broker = (rd_kafka_metadata_broker_t*)data;
- object_intern *intern;
-@@ -209,7 +200,7 @@ void kafka_metadata_broker_ctor(zval *return_value, zval *zmetadata, const void
- return;
- }
-
-- intern = get_custom_object_zval(object_intern, return_value);
-+ intern = Z_RDKAFKA_P(object_intern, return_value);
- if (!intern) {
- return;
- }
-diff --git a/metadata_broker.h b/metadata_broker.h
-index 0cf4e4b..6f64928 100644
---- a/metadata_broker.h
-+++ b/metadata_broker.h
-@@ -16,5 +16,5 @@
- +----------------------------------------------------------------------+
- */
-
--void kafka_metadata_broker_minit(TSRMLS_D);
--void kafka_metadata_broker_ctor(zval *return_value, zval *zmetadata, const void *metadata_broker TSRMLS_DC);
-+void kafka_metadata_broker_minit(INIT_FUNC_ARGS);
-+void kafka_metadata_broker_ctor(zval *return_value, zval *zmetadata, const void *metadata_broker);
-diff --git a/metadata_collection.c b/metadata_collection.c
-index 62867bc..af986ff 100644
---- a/metadata_collection.c
-+++ b/metadata_collection.c
-@@ -28,90 +28,82 @@
- #include "Zend/zend_interfaces.h"
- #include "metadata_collection.h"
- #include "Zend/zend_exceptions.h"
--#include "zeval.h"
-
- typedef struct _object_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- zval zmetadata;
- const void *items;
- size_t item_cnt;
- size_t item_size;
- size_t position;
- kafka_metadata_collection_ctor_t ctor;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } object_intern;
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC);
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp);
-
- static zend_class_entry *ce;
- static zend_object_handlers handlers;
-
--static void free_object(zend_object *object TSRMLS_DC) /* {{{ */
-+static void free_object(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
-
- if (intern->items) {
- zval_dtor(&intern->zmetadata);
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *create_object(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_object, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *zmti TSRMLS_DC)
-+static object_intern * get_object(zval *zmti)
- {
-- object_intern *omti = get_custom_object_zval(object_intern, zmti);
-+ object_intern *omti = Z_RDKAFKA_P(object_intern, zmti);
-
- if (!omti->items) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Metadata\\Collection::__construct() has not been called" TSRMLS_CC);
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Metadata\\Collection::__construct() has not been called");
- return NULL;
- }
-
- return omti;
- }
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */
- {
- zval ary;
- object_intern *intern;
- size_t i;
-- zeval item;
-+ zval item;
-
- *is_temp = 1;
-
- array_init(&ary);
-
-- intern = get_object(object TSRMLS_CC);
-+ intern = rdkafka_get_debug_object(object_intern, object);
- if (!intern) {
- return Z_ARRVAL(ary);
- }
-
- for (i = 0; i < intern->item_cnt; i++) {
-- MAKE_STD_ZEVAL(item);
-- intern->ctor(P_ZEVAL(item), &intern->zmetadata, (char *)intern->items + i * intern->item_size TSRMLS_CC);
-- add_next_index_zval(&ary, P_ZEVAL(item));
-+ ZVAL_NULL(&item);
-+ intern->ctor(&item, &intern->zmetadata, (char *)intern->items + i * intern->item_size);
-+ add_next_index_zval(&ary, &item);
- }
-
- return Z_ARRVAL(ary);
-@@ -132,7 +124,7 @@ PHP_METHOD(RdKafka__Metadata__Collection, count)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -155,7 +147,7 @@ PHP_METHOD(RdKafka__Metadata__Collection, rewind)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -178,17 +170,17 @@ PHP_METHOD(RdKafka__Metadata__Collection, current)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (intern->position >= intern->item_cnt) {
-- zend_throw_exception(ce_kafka_exception, "Called current() on invalid iterator", 0 TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "Called current() on invalid iterator", 0);
- return;
- }
-
-- intern->ctor(return_value, &intern->zmetadata, (char *)intern->items + intern->position * intern->item_size TSRMLS_CC);
-+ intern->ctor(return_value, &intern->zmetadata, (char *)intern->items + intern->position * intern->item_size);
- }
- /* }}} */
-
-@@ -206,13 +198,13 @@ PHP_METHOD(RdKafka__Metadata__Collection, key)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (intern->position >= intern->item_cnt) {
-- zend_throw_exception(ce_kafka_exception, "Called key() on invalid iterator", 0 TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, "Called key() on invalid iterator", 0);
- return;
- }
-
-@@ -234,7 +226,7 @@ PHP_METHOD(RdKafka__Metadata__Collection, next)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -257,7 +249,7 @@ PHP_METHOD(RdKafka__Metadata__Collection, valid)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -276,22 +268,22 @@ static const zend_function_entry fe[] = {
- PHP_FE_END
- };
-
--void kafka_metadata_collection_minit(TSRMLS_D)
-+void kafka_metadata_collection_minit(INIT_FUNC_ARGS)
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka\\Metadata", "Collection", fe);
-- ce = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce = zend_register_internal_class(&tmpce);
- ce->create_object = create_object;
-- zend_class_implements(ce TSRMLS_CC, 2, spl_ce_Countable, spl_ce_Iterator);
-+ zend_class_implements(ce, 2, spl_ce_Countable, spl_ce_Iterator);
-
- handlers = kafka_default_object_handlers;
- handlers.get_debug_info = get_debug_info;
-- set_object_handler_free_obj(&handlers, free_object);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = free_object;
-+ handlers.offset = XtOffsetOf(object_intern, std);
- }
-
--void kafka_metadata_collection_init(zval *return_value, zval *zmetadata, const void * items, size_t item_cnt, size_t item_size, kafka_metadata_collection_ctor_t ctor TSRMLS_DC)
-+void kafka_metadata_collection_init(zval *return_value, Z_RDKAFKA_OBJ *zmetadata, const void * items, size_t item_cnt, size_t item_size, kafka_metadata_collection_ctor_t ctor)
- {
- object_intern *intern;
-
-@@ -299,12 +291,14 @@ void kafka_metadata_collection_init(zval *return_value, zval *zmetadata, const v
- return;
- }
-
-- intern = get_custom_object_zval(object_intern, return_value);
-+ intern = Z_RDKAFKA_P(object_intern, return_value);
- if (!intern) {
- return;
- }
-
-+#if PHP_MAJOR_VERSION < 8
- ZVAL_ZVAL(&intern->zmetadata, zmetadata, 1, 0);
-+#endif
- intern->items = items;
- intern->item_cnt = item_cnt;
- intern->item_size = item_size;
-diff --git a/metadata_collection.h b/metadata_collection.h
-index 55539bb..fff2fd6 100644
---- a/metadata_collection.h
-+++ b/metadata_collection.h
-@@ -16,7 +16,7 @@
- +----------------------------------------------------------------------+
- */
-
--typedef void (*kafka_metadata_collection_ctor_t)(zval *renurn_value, zval *zmetadata, const void *object TSRMLS_DC);
-+typedef void (*kafka_metadata_collection_ctor_t)(zval *renurn_value, zval *zmetadata, const void *object);
-
--void kafka_metadata_collection_minit(TSRMLS_D);
--void kafka_metadata_collection_init(zval *return_value, zval *zmetadata, const void * items, size_t item_cnt, size_t item_size, kafka_metadata_collection_ctor_t ctor TSRMLS_DC);
-+void kafka_metadata_collection_minit(INIT_FUNC_ARGS);
-+void kafka_metadata_collection_init(zval *return_value, Z_RDKAFKA_OBJ *zmetadata, const void * items, size_t item_cnt, size_t item_size, kafka_metadata_collection_ctor_t ctor);
-diff --git a/metadata_partition.c b/metadata_partition.c
-index 17f5f3a..7fcabc2 100644
---- a/metadata_partition.c
-+++ b/metadata_partition.c
-@@ -30,64 +30,57 @@
- #include "metadata_collection.h"
-
- typedef struct _object_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- zval zmetadata;
- const rd_kafka_metadata_partition_t *metadata_partition;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } object_intern;
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC);
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp);
-
- static zend_class_entry * ce;
- static zend_object_handlers handlers;
-
--static void free_object(zend_object *object TSRMLS_DC) /* {{{ */
-+static void free_object(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
-
- if (intern->metadata_partition) {
- zval_dtor(&intern->zmetadata);
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *create_object(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_object, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *zmt TSRMLS_DC)
-+static object_intern * get_object(zval *zmt)
- {
-- object_intern *omt = get_custom_object_zval(object_intern, zmt);
-+ object_intern *omt = Z_RDKAFKA_P(object_intern, zmt);
-
- if (!omt->metadata_partition) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Metadata\\Partition::__construct() has not been called");
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Metadata\\Partition::__construct() has not been called");
- return NULL;
- }
-
- return omt;
- }
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */
- {
- zval ary;
- object_intern *intern;
-@@ -96,7 +89,7 @@ static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-
- array_init(&ary);
-
-- intern = get_object(object TSRMLS_CC);
-+ intern = rdkafka_get_debug_object(object_intern, object);
- if (!intern) {
- return Z_ARRVAL(ary);
- }
-@@ -125,7 +118,7 @@ PHP_METHOD(RdKafka__Metadata__Partition, getId)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -148,7 +141,7 @@ PHP_METHOD(RdKafka__Metadata__Partition, getErr)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -171,7 +164,7 @@ PHP_METHOD(RdKafka__Metadata__Partition, getLeader)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -180,7 +173,7 @@ PHP_METHOD(RdKafka__Metadata__Partition, getLeader)
- }
- /* }}} */
-
--void int32_ctor(zval *return_value, zval *zmetadata, const void *data TSRMLS_DC) {
-+void int32_ctor(zval *return_value, zval *zmetadata, const void *data) {
- ZVAL_LONG(return_value, *(int32_t*)data);
- }
-
-@@ -198,12 +191,12 @@ PHP_METHOD(RdKafka__Metadata__Partition, getReplicas)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- kafka_metadata_collection_init(return_value, getThis(), intern->metadata_partition->replicas, intern->metadata_partition->replica_cnt, sizeof(*intern->metadata_partition->replicas), int32_ctor TSRMLS_CC);
-+ kafka_metadata_collection_init(return_value, Z_RDKAFKA_PROP_OBJ(getThis()), intern->metadata_partition->replicas, intern->metadata_partition->replica_cnt, sizeof(*intern->metadata_partition->replicas), int32_ctor);
- }
- /* }}} */
-
-@@ -221,12 +214,12 @@ PHP_METHOD(RdKafka__Metadata__Partition, getIsrs)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- kafka_metadata_collection_init(return_value, getThis(), intern->metadata_partition->isrs, intern->metadata_partition->isr_cnt, sizeof(*intern->metadata_partition->isrs), int32_ctor TSRMLS_CC);
-+ kafka_metadata_collection_init(return_value, Z_RDKAFKA_PROP_OBJ(getThis()), intern->metadata_partition->isrs, intern->metadata_partition->isr_cnt, sizeof(*intern->metadata_partition->isrs), int32_ctor);
- }
- /* }}} */
-
-@@ -239,21 +232,21 @@ static const zend_function_entry fe[] = {
- PHP_FE_END
- };
-
--void kafka_metadata_partition_minit(TSRMLS_D)
-+void kafka_metadata_partition_minit(INIT_FUNC_ARGS)
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "Metadata\\Partition", fe);
-- ce = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce = zend_register_internal_class(&tmpce);
- ce->create_object = create_object;
-
- handlers = kafka_default_object_handlers;
- handlers.get_debug_info = get_debug_info;
-- set_object_handler_free_obj(&handlers, free_object);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = free_object;
-+ handlers.offset = XtOffsetOf(object_intern, std);
- }
-
--void kafka_metadata_partition_ctor(zval *return_value, zval *zmetadata, const void *data TSRMLS_DC)
-+void kafka_metadata_partition_ctor(zval *return_value, zval *zmetadata, const void *data)
- {
- rd_kafka_metadata_partition_t *metadata_partition = (rd_kafka_metadata_partition_t*)data;
- object_intern *intern;
-@@ -262,7 +255,7 @@ void kafka_metadata_partition_ctor(zval *return_value, zval *zmetadata, const vo
- return;
- }
-
-- intern = get_custom_object_zval(object_intern, return_value);
-+ intern = Z_RDKAFKA_P(object_intern, return_value);
- if (!intern) {
- return;
- }
-diff --git a/metadata_partition.h b/metadata_partition.h
-index a3da72c..8ce35b8 100644
---- a/metadata_partition.h
-+++ b/metadata_partition.h
-@@ -16,5 +16,5 @@
- +----------------------------------------------------------------------+
- */
-
--void kafka_metadata_partition_minit(TSRMLS_D);
--void kafka_metadata_partition_ctor(zval *return_value, zval *zmetadata, const void *metadata_partition TSRMLS_DC);
-+void kafka_metadata_partition_minit(INIT_FUNC_ARGS);
-+void kafka_metadata_partition_ctor(zval *return_value, zval *zmetadata, const void *metadata_partition);
-diff --git a/metadata_topic.c b/metadata_topic.c
-index 6784316..5aeeed7 100644
---- a/metadata_topic.c
-+++ b/metadata_topic.c
-@@ -29,91 +29,83 @@
- #include "metadata_partition.h"
- #include "metadata_collection.h"
- #include "Zend/zend_exceptions.h"
--#include "zeval.h"
-
- typedef struct _object_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- zval zmetadata;
- const rd_kafka_metadata_topic_t *metadata_topic;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } object_intern;
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC);
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp);
-
- static zend_class_entry * ce;
- static zend_object_handlers handlers;
-
--static void partitions_collection(zval *return_value, zval *parent, object_intern *intern TSRMLS_DC) { /* {{{ */
-- kafka_metadata_collection_init(return_value, parent, intern->metadata_topic->partitions, intern->metadata_topic->partition_cnt, sizeof(*intern->metadata_topic->partitions), kafka_metadata_partition_ctor TSRMLS_CC);
-+static void partitions_collection(zval *return_value, Z_RDKAFKA_OBJ *parent, object_intern *intern) { /* {{{ */
-+ kafka_metadata_collection_init(return_value, parent, intern->metadata_topic->partitions, intern->metadata_topic->partition_cnt, sizeof(*intern->metadata_topic->partitions), kafka_metadata_partition_ctor);
- }
- /* }}} */
-
--static void free_object(zend_object *object TSRMLS_DC) /* {{{ */
-+static void free_object(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
-
- if (intern->metadata_topic) {
- zval_dtor(&intern->zmetadata);
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *create_object(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_object, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *zmt TSRMLS_DC)
-+static object_intern * get_object(zval *zmt)
- {
-- object_intern *omt = get_custom_object_zval(object_intern, zmt);
-+ object_intern *omt = Z_RDKAFKA_P(object_intern, zmt);
-
- if (!omt->metadata_topic) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Metadata\\Topic::__construct() has not been called");
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Metadata\\Topic::__construct() has not been called");
- return NULL;
- }
-
- return omt;
- }
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */
- {
- zval ary;
- object_intern *intern;
-- zeval partitions;
-+ zval partitions;
-
- *is_temp = 1;
-
- array_init(&ary);
-
-- intern = get_object(object TSRMLS_CC);
-+ intern = rdkafka_get_debug_object(object_intern, object);
- if (!intern) {
- return Z_ARRVAL(ary);
- }
-
-- rdkafka_add_assoc_string(&ary, "topic", intern->metadata_topic->topic);
-+ add_assoc_string(&ary, "topic", intern->metadata_topic->topic);
-
-- MAKE_STD_ZEVAL(partitions);
-- partitions_collection(P_ZEVAL(partitions), object, intern TSRMLS_CC);
-- add_assoc_zval(&ary, "partitions", P_ZEVAL(partitions));
-+ ZVAL_NULL(&partitions);
-+ partitions_collection(&partitions, object, intern);
-+ add_assoc_zval(&ary, "partitions", &partitions);
-
- add_assoc_long(&ary, "err", intern->metadata_topic->err);
-
-@@ -135,12 +127,12 @@ PHP_METHOD(RdKafka__Metadata__Topic, getTopic)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- RDKAFKA_RETURN_STRING(intern->metadata_topic->topic);
-+ RETURN_STRING(intern->metadata_topic->topic);
- }
- /* }}} */
-
-@@ -158,7 +150,7 @@ PHP_METHOD(RdKafka__Metadata__Topic, getErr)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -182,12 +174,12 @@ PHP_METHOD(RdKafka__Metadata__Topic, getPartitions)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
-- partitions_collection(return_value, getThis(), intern TSRMLS_CC);
-+ partitions_collection(return_value, Z_RDKAFKA_PROP_OBJ(getThis()), intern);
- }
- /* }}} */
-
-@@ -198,21 +190,21 @@ static const zend_function_entry fe[] = {
- PHP_FE_END
- };
-
--void kafka_metadata_topic_minit(TSRMLS_D)
-+void kafka_metadata_topic_minit(INIT_FUNC_ARGS)
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka\\Metadata", "Topic", fe);
-- ce = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce = zend_register_internal_class(&tmpce);
- ce->create_object = create_object;
-
- handlers = kafka_default_object_handlers;
- handlers.get_debug_info = get_debug_info;
-- set_object_handler_free_obj(&handlers, free_object);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = free_object;
-+ handlers.offset = XtOffsetOf(object_intern, std);
- }
-
--void kafka_metadata_topic_ctor(zval *return_value, zval *zmetadata, const void *data TSRMLS_DC)
-+void kafka_metadata_topic_ctor(zval *return_value, zval *zmetadata, const void *data)
- {
- rd_kafka_metadata_topic_t *metadata_topic = (rd_kafka_metadata_topic_t*)data;
- object_intern *intern;
-@@ -221,7 +213,7 @@ void kafka_metadata_topic_ctor(zval *return_value, zval *zmetadata, const void *
- return;
- }
-
-- intern = get_custom_object_zval(object_intern, return_value);
-+ intern = Z_RDKAFKA_P(object_intern, return_value);
- if (!intern) {
- return;
- }
-diff --git a/metadata_topic.h b/metadata_topic.h
-index 128fec0..677203d 100644
---- a/metadata_topic.h
-+++ b/metadata_topic.h
-@@ -16,5 +16,5 @@
- +----------------------------------------------------------------------+
- */
-
--void kafka_metadata_topic_minit(TSRMLS_D);
--void kafka_metadata_topic_ctor(zval *return_value, zval *zmetadata, const void *metadata_topic TSRMLS_DC);
-+void kafka_metadata_topic_minit(INIT_FUNC_ARGS);
-+void kafka_metadata_topic_ctor(zval *return_value, zval *zmetadata, const void *metadata_topic);
-diff --git a/php_rdkafka.h b/php_rdkafka.h
-index e007877..19bef56 100644
---- a/php_rdkafka.h
-+++ b/php_rdkafka.h
-@@ -22,7 +22,6 @@
- #define PHP_RDKAFKA_H
-
- #include "librdkafka/rdkafka.h"
--#include "compat.h"
- #include "conf.h"
-
- #ifndef PHP_FE_END
-@@ -30,18 +29,13 @@
- #endif
-
- typedef struct _kafka_object {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- rd_kafka_type_t type;
- rd_kafka_t *rk;
- kafka_conf_callbacks cbs;
- HashTable consuming;
- HashTable topics;
- HashTable queues;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } kafka_object;
-
- PHP_METHOD(RdKafka, __construct);
-@@ -62,8 +56,4 @@ extern zend_class_entry * ce_kafka_exception;
- # define PHP_RDKAFKA_API
- #endif
-
--#ifdef ZTS
--#include "TSRM.h"
--#endif
--
- #endif /* PHP_RDKAFKA_H */
-diff --git a/php_rdkafka_priv.h b/php_rdkafka_priv.h
-index 434e0e9..922a88d 100644
---- a/php_rdkafka_priv.h
-+++ b/php_rdkafka_priv.h
-@@ -19,53 +19,30 @@
- #ifndef PHP_RDKAFKA_PRIV_H
- #define PHP_RDKAFKA_PRIV_H
-
--#if PHP_MAJOR_VERSION >= 7
-+#if PHP_MAJOR_VERSION >= 8
-
--typedef zend_object* zend_object_value;
-+#define Z_RDKAFKA_OBJ zend_object
-
--typedef size_t arglen_t;
-+#define Z_RDKAFKA_PROP_OBJ(object) Z_OBJ_P(object)
-
--#define STORE_OBJECT(retval, intern, dtor, free, clone) do { \
-- retval = &intern->std; \
--} while (0)
-+#define rdkafka_get_debug_object(type, object) php_kafka_from_obj(type, object)
-
--#define SET_OBJECT_HANDLERS(retval, _handlers) do { \
-- retval->handlers = _handlers; \
--} while (0)
-+#else // PHP 7
-
--#define alloc_object(intern, ce) ecalloc(1, sizeof(*intern) + zend_object_properties_size(ce))
-+#define Z_RDKAFKA_OBJ zval
-
--static inline zval * is_zval(zval * zv) {
-- return zv;
--}
--
--#define get_custom_object_zval(type, zobject) \
-- ((type*)((char *)Z_OBJ_P(is_zval(zobject)) - XtOffsetOf(type, std)))
-+#define Z_RDKAFKA_PROP_OBJ(object) object
-
--static inline zend_object * is_zend_object(zend_object * object) {
-- return object;
--}
-+#define rdkafka_get_debug_object(type, object) get_object(object)
-
--#define get_custom_object(type, object) \
-- ((type*)((char *)is_zend_object(object) - XtOffsetOf(type, std)))
-+#endif
-
--#define free_custom_object(object) /* no-op */
-+#define Z_RDKAFKA_P(php_kafka_type, zobject) php_kafka_from_obj(php_kafka_type, Z_OBJ_P(zobject))
-
--static inline zend_class_entry *rdkafka_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce TSRMLS_DC)
--{
-- return zend_register_internal_class_ex(class_entry, parent_ce);
--}
--
--static inline void set_object_handler_free_obj(zend_object_handlers * handlers, zend_object_free_obj_t free_obj)
--{
-- handlers->free_obj = free_obj;
--}
--static inline void set_object_handler_offset(zend_object_handlers * handlers, size_t offset)
--{
-- handlers->offset = offset;
--}
-+#define php_kafka_from_obj(php_kafka_type, object) \
-+ ((php_kafka_type*)((char *)(object) - XtOffsetOf(php_kafka_type, std)))
-
--static inline void rdkafka_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache, zval *retval, uint32_t param_count, zval params[] TSRMLS_DC)
-+static inline void rdkafka_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache, zval *retval, uint32_t param_count, zval params[])
- {
- int local_retval;
- zval local_retval_zv;
-@@ -81,23 +58,19 @@ static inline void rdkafka_call_function(zend_fcall_info *fci, zend_fcall_info_c
- fci->params = params;
- fci->param_count = param_count;
-
-- zend_call_function(fci, fci_cache TSRMLS_CC);
-+ zend_call_function(fci, fci_cache);
-
- if (local_retval) {
- zval_ptr_dtor(retval);
- }
- }
-
--static inline zval *rdkafka_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent TSRMLS_DC)
-+static inline zval *rdkafka_read_property(zend_class_entry *scope, Z_RDKAFKA_OBJ *object, const char *name, size_t name_length, zend_bool silent)
- {
- zval rv;
-- return zend_read_property(scope, object, name, name_length, silent, &rv TSRMLS_CC);
-+ return zend_read_property(scope, object, name, name_length, silent, &rv);
- }
-
--static inline zval *rdkafka_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
--{
-- return zend_hash_get_current_data_ex(ht, pos);
--}
-
- static inline char *rdkafka_hash_get_current_key_ex(HashTable *ht, HashPosition *pos)
- {
-@@ -111,148 +84,7 @@ static inline char *rdkafka_hash_get_current_key_ex(HashTable *ht, HashPosition
- return NULL;
- }
-
--#define rdkafka_add_assoc_string(arg, key, str) add_assoc_string(arg, key, str)
--
--#define rdkafka_add_assoc_stringl(arg, key, str, str_length) add_assoc_stringl(arg, key, str, str_length)
--
--#define RDKAFKA_RETURN_STRING(str) RETURN_STRING(str)
--#define RDKAFKA_ZVAL_STRING(zv, str) ZVAL_STRING(zv, str)
--#else /* PHP < 7 */
--
--typedef long zend_long;
--#define ZEND_LONG_FMT "%ld"
--
--typedef int arglen_t;
--
--#define STORE_OBJECT(retval, intern, dtor, free, clone) do { \
-- void (*___free_object_storage)(zend_object *object TSRMLS_DC) = free; \
-- retval.handle = zend_objects_store_put(&intern->std, dtor, (zend_objects_free_object_storage_t)___free_object_storage, clone TSRMLS_CC); \
--} while (0)
--
--#define SET_OBJECT_HANDLERS(retval, _handlers) do { \
-- retval.handlers = _handlers; \
--} while (0)
--
--#define alloc_object(intern, ce) ecalloc(1, sizeof(*intern))
--
--#define get_custom_object_zval(type, zobject) \
-- ((type*)zend_object_store_get_object(zobject TSRMLS_CC))
--
--#define get_custom_object(type, object) \
-- ((type*)object)
--
--#define free_custom_object(object) efree(object)
--
--static inline void *zend_hash_str_add_ptr(HashTable *ht, const char *str, size_t len, void *pData)
--{
-- void *pDest;
-- zend_hash_add(ht, str, len, &pData, sizeof(pData), &pDest);
-- return pDest;
--}
--
--static inline int zend_hash_str_del(HashTable *ht, const char *str, size_t len)
--{
-- return zend_hash_del(ht, str, len);
--}
--
--static inline zend_bool zend_hash_str_exists(const HashTable *ht, const char *str, size_t len)
--{
-- return zend_hash_exists(ht, str, len);
--}
--
--static inline void *zend_hash_index_add_ptr(HashTable *ht, zend_ulong h, void *pData)
--{
-- void *pDest;
-- zend_hash_index_update(ht, h, &pData, sizeof(pData), &pDest);
-- return pDest;
--}
--
--static inline zend_class_entry *rdkafka_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce TSRMLS_DC)
--{
-- return zend_register_internal_class_ex(class_entry, parent_ce, NULL TSRMLS_CC);
--}
--
--typedef void (*zend_object_free_obj_t)(zend_object *object);
--static inline void set_object_handler_free_obj(zend_object_handlers * handlers, zend_object_free_obj_t free_obj)
--{
-- /* no-op */
--}
--
--static inline void set_object_handler_offset(zend_object_handlers * handlers, size_t offset)
--{
-- /* no-op */
--}
--
--static inline void rdkafka_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache, zval **retval, uint32_t param_count, zval *params[] TSRMLS_DC)
--{
-- uint32_t i;
-- int local_retval;
-- zval *local_retval_zv;
-- zval ***params_array;
--
-- if (retval) {
-- local_retval = 0;
-- } else {
-- local_retval = 1;
-- retval = &local_retval_zv;
-- }
--
-- params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
-- for (i = 0; i < param_count; i++) {
-- params_array[i] = &params[i];
-- }
--
-- fci->retval_ptr_ptr = retval;
-- fci->params = params_array;
-- fci->param_count = param_count;
--
-- zend_call_function(fci, fci_cache TSRMLS_CC);
--
-- if (local_retval && *retval) {
-- zval_ptr_dtor(retval);
-- }
--
-- efree(params_array);
--}
--
--static inline zval *rdkafka_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent TSRMLS_DC)
--{
-- return zend_read_property(scope, object, name, name_length, silent TSRMLS_CC);
--}
--
--static inline zval **rdkafka_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
--{
-- zval **zv;
--
-- if (zend_hash_get_current_data_ex(ht, (void**)&zv, pos) == SUCCESS) {
-- return zv;
-- }
--
-- return NULL;
--}
--
--static inline char **rdkafka_hash_get_current_key_ex(HashTable *ht, HashPosition *pos)
--{
-- char *key = NULL;
-- uint klen;
-- ulong index;
--
-- if (zend_hash_get_current_key_ex(ht, &key, &klen, &index, 0, pos) == HASH_KEY_IS_STRING) {
-- return key;
-- }
--
-- return NULL;
--}
--
--#define rdkafka_add_assoc_string(arg, key, str) add_assoc_string(arg, key, str, 1)
--
--#define rdkafka_add_assoc_stringl(arg, key, str, str_length) add_assoc_stringl(arg, key, str, str_length, 1)
--
--#define RDKAFKA_RETURN_STRING(str) RETURN_STRING(str, 1)
--#define RDKAFKA_ZVAL_STRING(zv, str) ZVAL_STRING(zv, str, 1)
--#endif
--
--kafka_object * get_kafka_object(zval *zrk TSRMLS_DC);
-+kafka_object * get_kafka_object(zval *zrk);
- void add_consuming_toppar(kafka_object * intern, rd_kafka_topic_t * rkt, int32_t partition);
- void del_consuming_toppar(kafka_object * intern, rd_kafka_topic_t * rkt, int32_t partition);
- int is_consuming_toppar(kafka_object * intern, rd_kafka_topic_t * rkt, int32_t partition);
-diff --git a/queue.c b/queue.c
-index 7d661d0..182563a 100644
---- a/queue.c
-+++ b/queue.c
-@@ -35,45 +35,43 @@ zend_class_entry * ce_kafka_queue;
-
- static zend_object_handlers handlers;
-
--static void kafka_queue_free(zend_object *object TSRMLS_DC) /* {{{ */
-+static void kafka_queue_free(zend_object *object) /* {{{ */
- {
-- kafka_queue_object *intern = get_custom_object(kafka_queue_object, object);
-+ kafka_queue_object *intern = php_kafka_from_obj(kafka_queue_object, object);
-
- if (intern->rkqu) {
-- kafka_object *kafka_intern = get_kafka_object(P_ZEVAL(intern->zrk) TSRMLS_CC);
-+ kafka_object *kafka_intern = get_kafka_object(&intern->zrk);
- if (kafka_intern) {
- zend_hash_index_del(&kafka_intern->queues, (zend_ulong)intern);
- }
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value kafka_queue_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *kafka_queue_new(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- kafka_queue_object *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, kafka_queue_free, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--kafka_queue_object * get_kafka_queue_object(zval *zrkqu TSRMLS_DC)
-+kafka_queue_object * get_kafka_queue_object(zval *zrkqu)
- {
-- kafka_queue_object *orkqu = get_custom_object_zval(kafka_queue_object, zrkqu);
-+ kafka_queue_object *orkqu = Z_RDKAFKA_P(kafka_queue_object, zrkqu);
-
- if (!orkqu->rkqu) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Queue::__construct() has not been called" TSRMLS_CC);
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Queue::__construct() has not been called");
- return NULL;
- }
-
-@@ -94,11 +92,11 @@ PHP_METHOD(RdKafka__Queue, consume)
- rd_kafka_message_t *message;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_queue_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_queue_object(getThis());
- if (!intern) {
- return;
- }
-@@ -110,11 +108,11 @@ PHP_METHOD(RdKafka__Queue, consume)
- if (err == RD_KAFKA_RESP_ERR__TIMED_OUT) {
- return;
- }
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-- kafka_message_new(return_value, message TSRMLS_CC);
-+ kafka_message_new(return_value, message);
-
- rd_kafka_message_destroy(message);
- }
-@@ -129,15 +127,15 @@ static const zend_function_entry kafka_queue_fe[] = {
- PHP_FE_END
- };
-
--void kafka_queue_minit(TSRMLS_D) { /* {{{ */
-+void kafka_queue_minit(INIT_FUNC_ARGS) { /* {{{ */
-
- zend_class_entry ce;
-
- handlers = kafka_default_object_handlers;
-- set_object_handler_free_obj(&handlers, kafka_queue_free);
-- set_object_handler_offset(&handlers, XtOffsetOf(kafka_queue_object, std));
-+ handlers.free_obj = kafka_queue_free;
-+ handlers.offset = XtOffsetOf(kafka_queue_object, std);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Queue", kafka_queue_fe);
-- ce_kafka_queue = zend_register_internal_class(&ce TSRMLS_CC);
-+ ce_kafka_queue = zend_register_internal_class(&ce);
- ce_kafka_queue->create_object = kafka_queue_new;
- } /* }}} */
-diff --git a/queue.h b/queue.h
-index 8d8ab66..c3ecb78 100644
---- a/queue.h
-+++ b/queue.h
-@@ -17,17 +17,12 @@
- */
-
- typedef struct _kafka_queue_object {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- rd_kafka_queue_t *rkqu;
-- zeval zrk;
--#if PHP_MAJOR_VERSION >= 7
-+ zval zrk;
- zend_object std;
--#endif
- } kafka_queue_object;
-
--void kafka_queue_minit(TSRMLS_D);
--kafka_queue_object * get_kafka_queue_object(zval *zrkqu TSRMLS_DC);
-+void kafka_queue_minit(INIT_FUNC_ARGS);
-+kafka_queue_object * get_kafka_queue_object(zval *zrkqu);
-
- extern zend_class_entry * ce_kafka_queue;
-diff --git a/rdkafka.c b/rdkafka.c
-index 2accdd9..50cf5b3 100644
---- a/rdkafka.c
-+++ b/rdkafka.c
-@@ -70,17 +70,17 @@ static void stop_consuming_toppar_pp(toppar ** tp) {
- rd_kafka_consume_stop((*tp)->rkt, (*tp)->partition);
- }
-
--static void stop_consuming(kafka_object * intern TSRMLS_DC) {
-- zend_hash_apply(&intern->consuming, (apply_func_t)stop_consuming_toppar_pp TSRMLS_CC);
-+static void stop_consuming(kafka_object * intern) {
-+ zend_hash_apply(&intern->consuming, (apply_func_t)stop_consuming_toppar_pp);
- }
-
--static void kafka_free(zend_object *object TSRMLS_DC) /* {{{ */
-+static void kafka_free(zend_object *object) /* {{{ */
- {
-- kafka_object *intern = get_custom_object(kafka_object, object);
-+ kafka_object *intern = php_kafka_from_obj(kafka_object, object);
-
- if (intern->rk) {
- if (intern->type == RD_KAFKA_CONSUMER) {
-- stop_consuming(intern TSRMLS_CC);
-+ stop_consuming(intern);
- zend_hash_destroy(&intern->consuming);
- zend_hash_destroy(&intern->queues);
- }
-@@ -90,11 +90,9 @@ static void kafka_free(zend_object *object TSRMLS_DC) /* {{{ */
- intern->rk = NULL;
- }
-
-- kafka_conf_callbacks_dtor(&intern->cbs TSRMLS_CC);
-+ kafka_conf_callbacks_dtor(&intern->cbs);
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
-@@ -116,7 +114,7 @@ static void kafka_topic_object_pre_free(kafka_topic_object ** pp) {
- zval_ptr_dtor(&intern->zrk);
- }
-
--static void kafka_init(zval *this_ptr, rd_kafka_type_t type, zval *zconf TSRMLS_DC) /* {{{ */
-+static void kafka_init(zval *this_ptr, rd_kafka_type_t type, zval *zconf) /* {{{ */
- {
- char errstr[512];
- rd_kafka_t *rk;
-@@ -124,14 +122,14 @@ static void kafka_init(zval *this_ptr, rd_kafka_type_t type, zval *zconf TSRMLS_
- kafka_conf_object *conf_intern;
- rd_kafka_conf_t *conf = NULL;
-
-- intern = get_custom_object_zval(kafka_object, this_ptr);
-+ intern = Z_RDKAFKA_P(kafka_object, this_ptr);
- intern->type = type;
-
- if (zconf) {
-- conf_intern = get_kafka_conf_object(zconf TSRMLS_CC);
-+ conf_intern = get_kafka_conf_object(zconf);
- if (conf_intern) {
- conf = rd_kafka_conf_dup(conf_intern->u.conf);
-- kafka_conf_callbacks_copy(&intern->cbs, &conf_intern->cbs TSRMLS_CC);
-+ kafka_conf_callbacks_copy(&intern->cbs, &conf_intern->cbs);
- intern->cbs.zrk = *this_ptr;
- rd_kafka_conf_set_opaque(conf, &intern->cbs);
- }
-@@ -140,7 +138,7 @@ static void kafka_init(zval *this_ptr, rd_kafka_type_t type, zval *zconf TSRMLS_
- rk = rd_kafka_new(type, conf, errstr, sizeof(errstr));
-
- if (rk == NULL) {
-- zend_throw_exception(ce_kafka_exception, errstr, 0 TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, errstr, 0);
- return;
- }
-
-@@ -159,28 +157,28 @@ static void kafka_init(zval *this_ptr, rd_kafka_type_t type, zval *zconf TSRMLS_
- }
- /* }}} */
-
--static zend_object_value kafka_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *kafka_new(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- kafka_object *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, kafka_free, NULL);
-- SET_OBJECT_HANDLERS(retval, &kafka_object_handlers);
-+ retval = &intern->std;
-+ retval->handlers = &kafka_object_handlers;
-
- return retval;
- }
- /* }}} */
-
--kafka_object * get_kafka_object(zval *zrk TSRMLS_DC)
-+kafka_object * get_kafka_object(zval *zrk)
- {
-- kafka_object *ork = get_custom_object_zval(kafka_object, zrk);
-+ kafka_object *ork = Z_RDKAFKA_P(kafka_object, zrk);
-
- if (!ork->rk) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Kafka::__construct() has not been called" TSRMLS_CC);
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Kafka::__construct() has not been called");
- return NULL;
- }
-
-@@ -241,7 +239,7 @@ int is_consuming_toppar(kafka_object * intern, rd_kafka_topic_t * rkt, int32_t p
- /* {{{ private constructor */
- PHP_METHOD(RdKafka, __construct)
- {
-- zend_throw_exception(NULL, "Private constructor", 0 TSRMLS_CC);
-+ zend_throw_exception(NULL, "Private constructor", 0);
- return;
- }
- /* }}} */
-@@ -257,16 +255,16 @@ PHP_METHOD(RdKafka__Consumer, __construct)
- zval *zconf = NULL;
- zend_error_handling error_handling;
-
-- zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
-+ zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!", &zconf, ce_kafka_conf) == FAILURE) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O!", &zconf, ce_kafka_conf) == FAILURE) {
-+ zend_restore_error_handling(&error_handling);
- return;
- }
-
-- kafka_init(getThis(), RD_KAFKA_CONSUMER, zconf TSRMLS_CC);
-+ kafka_init(getThis(), RD_KAFKA_CONSUMER, zconf);
-
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
- }
- /* }}} */
-
-@@ -282,11 +280,11 @@ PHP_METHOD(RdKafka__Consumer, newQueue)
- kafka_object *intern;
- kafka_queue_object *queue_intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -301,7 +299,7 @@ PHP_METHOD(RdKafka__Consumer, newQueue)
- return;
- }
-
-- queue_intern = get_custom_object_zval(kafka_queue_object, return_value);
-+ queue_intern = Z_RDKAFKA_P(kafka_queue_object, return_value);
- if (!queue_intern) {
- return;
- }
-@@ -311,12 +309,9 @@ PHP_METHOD(RdKafka__Consumer, newQueue)
- // Keep a reference to the parent Kafka object, attempts to ensure that
- // the Queue object is destroyed before the Kafka object.
- // This avoids rd_kafka_destroy() hanging.
--#if PHP_MAJOR_VERSION >= 7
- queue_intern->zrk = *getThis();
--#else
-- queue_intern->zrk = getThis();
--#endif
-- Z_ADDREF_P(P_ZEVAL(queue_intern->zrk));
-+
-+ Z_ADDREF_P(&queue_intern->zrk);
-
- zend_hash_index_add_ptr(&intern->queues, (zend_ulong)queue_intern, queue_intern);
- }
-@@ -338,14 +333,14 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__Kafka, addBrokers)
- {
- char *broker_list;
-- arglen_t broker_list_len;
-+ size_t broker_list_len;
- kafka_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &broker_list, &broker_list_len) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &broker_list, &broker_list_len) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -372,17 +367,17 @@ PHP_METHOD(RdKafka__Kafka, getMetadata)
- const rd_kafka_metadata_t *metadata;
- kafka_topic_object *only_orkt = NULL;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bO!l", &all_topics, &only_zrkt, ce_kafka_topic, &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "bO!l", &all_topics, &only_zrkt, ce_kafka_topic, &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-
- if (only_zrkt) {
-- only_orkt = get_kafka_topic_object(only_zrkt TSRMLS_CC);
-+ only_orkt = get_kafka_topic_object(only_zrkt);
- if (!only_orkt) {
- return;
- }
-@@ -391,14 +386,14 @@ PHP_METHOD(RdKafka__Kafka, getMetadata)
- err = rd_kafka_metadata(intern->rk, all_topics, only_orkt ? only_orkt->rkt : NULL, &metadata, timeout_ms);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-- kafka_metadata_init(return_value, metadata TSRMLS_CC);
-+ kafka_metadata_init(return_value, metadata);
- }
- /* }}} */
--
-+
- /* {{{ proto void RdKafka\Kafka::setLogLevel(int $level)
- Specifies the maximum logging level produced by internal kafka logging and debugging */
-
-@@ -411,11 +406,11 @@ PHP_METHOD(RdKafka__Kafka, setLogLevel)
- kafka_object *intern;
- zend_long level;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &level) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -435,7 +430,7 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__Kafka, newTopic)
- {
- char *topic;
-- arglen_t topic_len;
-+ size_t topic_len;
- rd_kafka_topic_t *rkt;
- kafka_object *intern;
- kafka_topic_object *topic_intern;
-@@ -444,17 +439,17 @@ PHP_METHOD(RdKafka__Kafka, newTopic)
- rd_kafka_topic_conf_t *conf = NULL;
- kafka_conf_object *conf_intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|O!", &topic, &topic_len, &zconf, ce_kafka_topic_conf) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|O!", &topic, &topic_len, &zconf, ce_kafka_topic_conf) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-
- if (zconf) {
-- conf_intern = get_kafka_conf_object(zconf TSRMLS_CC);
-+ conf_intern = get_kafka_conf_object(zconf);
- if (conf_intern) {
- conf = rd_kafka_topic_conf_dup(conf_intern->u.topic_conf);
- }
-@@ -481,18 +476,15 @@ PHP_METHOD(RdKafka__Kafka, newTopic)
- return;
- }
-
-- topic_intern = get_custom_object_zval(kafka_topic_object, return_value);
-+ topic_intern = Z_RDKAFKA_P(kafka_topic_object, return_value);
- if (!topic_intern) {
- return;
- }
-
- topic_intern->rkt = rkt;
--#if PHP_MAJOR_VERSION >= 7
- topic_intern->zrk = *getThis();
--#else
-- topic_intern->zrk = getThis();
--#endif
-- Z_ADDREF_P(P_ZEVAL(topic_intern->zrk));
-+
-+ Z_ADDREF_P(&topic_intern->zrk);
-
- zend_hash_index_add_ptr(&intern->topics, (zend_ulong)topic_intern, topic_intern);
- }
-@@ -508,11 +500,11 @@ PHP_METHOD(RdKafka__Kafka, getOutQLen)
- {
- kafka_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -533,11 +525,11 @@ PHP_METHOD(RdKafka__Kafka, poll)
- kafka_object *intern;
- zend_long timeout;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -558,11 +550,11 @@ PHP_METHOD(RdKafka__Kafka, flush)
- kafka_object *intern;
- zend_long timeout;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -584,11 +576,11 @@ PHP_METHOD(RdKafka__Kafka, purge)
- kafka_object *intern;
- zend_long purge_flags;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &purge_flags) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &purge_flags) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -613,20 +605,20 @@ PHP_METHOD(RdKafka__Kafka, queryWatermarkOffsets)
- {
- kafka_object *intern;
- char *topic;
-- arglen_t topic_length;
-+ size_t topic_length;
- long low, high;
- zend_long partition, timeout;
- zval *lowResult, *highResult;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "slzzl", &topic, &topic_length, &partition, &lowResult, &highResult, &timeout) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "slzzl", &topic, &topic_length, &partition, &lowResult, &highResult, &timeout) == FAILURE) {
- return;
- }
-
-- ZEVAL_DEREF(lowResult);
-- ZEVAL_DEREF(highResult);
-+ ZVAL_DEREF(lowResult);
-+ ZVAL_DEREF(highResult);
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -634,7 +626,7 @@ PHP_METHOD(RdKafka__Kafka, queryWatermarkOffsets)
- err = rd_kafka_query_watermark_offsets(intern->rk, topic, partition, &low, &high, timeout);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-@@ -657,16 +649,16 @@ PHP_METHOD(RdKafka__Kafka, offsetsForTimes)
- zend_long timeout_ms;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "hl", &htopars, &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "hl", &htopars, &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-
-- topicPartitions = array_arg_to_kafka_topic_partition_list(1, htopars TSRMLS_CC);
-+ topicPartitions = array_arg_to_kafka_topic_partition_list(1, htopars);
- if (!topicPartitions) {
- return;
- }
-@@ -675,15 +667,14 @@ PHP_METHOD(RdKafka__Kafka, offsetsForTimes)
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
- rd_kafka_topic_partition_list_destroy(topicPartitions);
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-- kafka_topic_partition_list_to_array(return_value, topicPartitions TSRMLS_CC);
-+ kafka_topic_partition_list_to_array(return_value, topicPartitions);
- rd_kafka_topic_partition_list_destroy(topicPartitions);
- }
- /* }}} */
-
--
- /* {{{ proto void RdKafka::setLogger(mixed $logger)
- Sets the log callback */
-
-@@ -697,11 +688,11 @@ PHP_METHOD(RdKafka__Kafka, setLogger)
- zend_long id;
- void (*logger) (const rd_kafka_t * rk, int level, const char *fac, const char *buf);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -719,7 +710,7 @@ PHP_METHOD(RdKafka__Kafka, setLogger)
- logger = kafka_log_syslog_print;
- break;
- default:
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Invalid logger" TSRMLS_CC);
-+ zend_throw_exception_ex(NULL, 0, "Invalid logger");
- return;
- }
-
-@@ -757,21 +748,20 @@ PHP_METHOD(RdKafka__Producer, __construct)
- zval *zconf = NULL;
- zend_error_handling error_handling;
-
-- zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
-+ zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!", &zconf, ce_kafka_conf) == FAILURE) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O!", &zconf, ce_kafka_conf) == FAILURE) {
-+ zend_restore_error_handling(&error_handling);
- return;
- }
-
-- kafka_init(getThis(), RD_KAFKA_PRODUCER, zconf TSRMLS_CC);
-+ kafka_init(getThis(), RD_KAFKA_PRODUCER, zconf);
-
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
- }
- /* }}} */
-
- #ifdef HAS_RD_KAFKA_TRANSACTIONS
--
- /* {{{ proto int RdKafka\Producer::initTransactions(int timeout_ms)
- Initializes transactions, needs to be done before producing and starting a transaction */
- ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_init_transactions, 0, 0, 1)
-@@ -784,11 +774,11 @@ PHP_METHOD(RdKafka__Producer, initTransactions)
- zend_long timeout_ms;
- const rd_kafka_error_t *error;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -799,8 +789,8 @@ PHP_METHOD(RdKafka__Producer, initTransactions)
- return;
- }
-
-- create_kafka_error(return_value, error TSRMLS_CC);
-- zend_throw_exception_object(return_value TSRMLS_CC);
-+ create_kafka_error(return_value, error);
-+ zend_throw_exception_object(return_value);
- }
- /* }}} */
-
-@@ -815,7 +805,7 @@ PHP_METHOD(RdKafka__Producer, beginTransaction)
- kafka_object *intern;
- const rd_kafka_error_t *error;
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -826,8 +816,8 @@ PHP_METHOD(RdKafka__Producer, beginTransaction)
- return;
- }
-
-- create_kafka_error(return_value, error TSRMLS_CC);
-- zend_throw_exception_object(return_value TSRMLS_CC);
-+ create_kafka_error(return_value, error);
-+ zend_throw_exception_object(return_value);
- }
- /* }}} */
-
-@@ -844,11 +834,11 @@ PHP_METHOD(RdKafka__Producer, commitTransaction)
- zend_long timeout_ms;
- const rd_kafka_error_t *error;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -859,8 +849,8 @@ PHP_METHOD(RdKafka__Producer, commitTransaction)
- return;
- }
-
-- create_kafka_error(return_value, error TSRMLS_CC);
-- zend_throw_exception_object(return_value TSRMLS_CC);
-+ create_kafka_error(return_value, error);
-+ zend_throw_exception_object(return_value);
- }
- /* }}} */
-
-@@ -877,11 +867,11 @@ PHP_METHOD(RdKafka__Producer, abortTransaction)
- zend_long timeout_ms;
- const rd_kafka_error_t *error;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout_ms) == FAILURE) {
- return;
- }
-
-- intern = get_kafka_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_object(getThis());
- if (!intern) {
- return;
- }
-@@ -892,11 +882,10 @@ PHP_METHOD(RdKafka__Producer, abortTransaction)
- return;
- }
-
-- create_kafka_error(return_value, error TSRMLS_CC);
-- zend_throw_exception_object(return_value TSRMLS_CC);
-+ create_kafka_error(return_value, error);
-+ zend_throw_exception_object(return_value);
- }
- /* }}} */
--
- #endif
-
- static const zend_function_entry kafka_producer_fe[] = {
-@@ -935,11 +924,7 @@ void register_err_constants(INIT_FUNC_ARGS) /* {{{ */
- len = sizeof(buf)-1;
- }
-
--#if PHP_MAJOR_VERSION < 7
-- len += 1;
--#endif
--
-- zend_register_long_constant(buf, len, desc->code, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
-+ zend_register_long_constant(buf, len, desc->code, CONST_CS | CONST_PERSISTENT, module_number);
- }
- } /* }}} */
-
-@@ -985,36 +970,36 @@ PHP_MINIT_FUNCTION(rdkafka)
- kafka_default_object_handlers.clone_obj = NULL;
-
- kafka_object_handlers = kafka_default_object_handlers;
-- set_object_handler_free_obj(&kafka_object_handlers, kafka_free);
-- set_object_handler_offset(&kafka_object_handlers, XtOffsetOf(kafka_object, std));
-+ kafka_object_handlers.free_obj = kafka_free;
-+ kafka_object_handlers.offset = XtOffsetOf(kafka_object, std);
-
- INIT_CLASS_ENTRY(ce, "RdKafka", kafka_fe);
-- ce_kafka = zend_register_internal_class(&ce TSRMLS_CC);
-+ ce_kafka = zend_register_internal_class(&ce);
- ce_kafka->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
- ce_kafka->create_object = kafka_new;
-
-- zend_declare_property_null(ce_kafka, ZEND_STRL("error_cb"), ZEND_ACC_PRIVATE TSRMLS_CC);
-- zend_declare_property_null(ce_kafka, ZEND_STRL("dr_cb"), ZEND_ACC_PRIVATE TSRMLS_CC);
-+ zend_declare_property_null(ce_kafka, ZEND_STRL("error_cb"), ZEND_ACC_PRIVATE);
-+ zend_declare_property_null(ce_kafka, ZEND_STRL("dr_cb"), ZEND_ACC_PRIVATE);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Consumer", kafka_consumer_fe);
-- ce_kafka_consumer = rdkafka_register_internal_class_ex(&ce, ce_kafka TSRMLS_CC);
-+ ce_kafka_consumer = zend_register_internal_class_ex(&ce, ce_kafka);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Producer", kafka_producer_fe);
-- ce_kafka_producer = rdkafka_register_internal_class_ex(&ce, ce_kafka TSRMLS_CC);
-+ ce_kafka_producer = zend_register_internal_class_ex(&ce, ce_kafka);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Exception", NULL);
-- ce_kafka_exception = rdkafka_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
-+ ce_kafka_exception = zend_register_internal_class_ex(&ce, zend_ce_exception);
-
-- kafka_conf_minit(TSRMLS_C);
-+ kafka_conf_minit(INIT_FUNC_ARGS_PASSTHRU);
- #ifdef HAS_RD_KAFKA_TRANSACTIONS
-- kafka_error_minit(TSRMLS_C);
-+ kafka_error_minit();
- #endif
-- kafka_kafka_consumer_minit(TSRMLS_C);
-- kafka_message_minit(TSRMLS_C);
-- kafka_metadata_minit(TSRMLS_C);
-- kafka_metadata_topic_partition_minit(TSRMLS_C);
-- kafka_queue_minit(TSRMLS_C);
-- kafka_topic_minit(TSRMLS_C);
-+ kafka_kafka_consumer_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_message_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_metadata_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_metadata_topic_partition_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_queue_minit(INIT_FUNC_ARGS_PASSTHRU);
-+ kafka_topic_minit(INIT_FUNC_ARGS_PASSTHRU);
-
- return SUCCESS;
- }
-diff --git a/tests/bug115.phpt b/tests/bug115.phpt
-index 5ea0af8..8c1620d 100644
---- a/tests/bug115.phpt
-+++ b/tests/bug115.phpt
-@@ -17,12 +17,6 @@ $conf->setErrorCb(function ($producer, $err, $errstr) {
- printf("%s: %s\n", rd_kafka_err2str($err), $errstr);
- exit;
- });
--$conf->setDrMsgCb(function ($producer, $msg) use (&$delivered) {
-- if ($msg->err) {
-- throw new Exception("Message delivery failed: " . $msg->errstr());
-- }
-- $delivered++;
--});
- $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-
- $topicName = sprintf("test_rdkafka_%s", uniqid());
-diff --git a/tests/bug74.phpt b/tests/bug74.phpt
-index 8cb23fd..04f4857 100644
---- a/tests/bug74.phpt
-+++ b/tests/bug74.phpt
-@@ -1,10 +1,14 @@
- --TEST--
- Bug 74
-+--SKIPIF--
-+<?php
-+require __DIR__ . '/integration-tests-check.php';
- --FILE--
- <?php
-+require __DIR__ . '/integration-tests-check.php';
-
- $conf = new RdKafka\Conf();
--$conf->set('metadata.broker.list', 'localhost:9092');
-+$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-
- $consumer = new RdKafka\Consumer($conf);
- $topic = $consumer->newTopic("batman", null);
-diff --git a/tests/conf_setDefaultTopicConf.phpt b/tests/conf_setDefaultTopicConf.phpt
-index 6b48505..ad08f3b 100644
---- a/tests/conf_setDefaultTopicConf.phpt
-+++ b/tests/conf_setDefaultTopicConf.phpt
-@@ -2,7 +2,7 @@
- RdKafka\Conf::setDefaultTopicConf()
- --SKIPIF--
- <?php
--if (!method_exists('RdKafka\Conf', 'setDefaultTopicConf')) {
-+if (!method_exists('RdKafka\Conf', 'setDefaultTopicConf') || 7 < PHP_MAJOR_VERSION) {
- echo "skip";
- }
- ?>
-diff --git a/tests/conf_setDefaultTopicConf8.phpt b/tests/conf_setDefaultTopicConf8.phpt
-new file mode 100644
-index 0000000..e5fdfe1
---- /dev/null
-+++ b/tests/conf_setDefaultTopicConf8.phpt
-@@ -0,0 +1,38 @@
-+--TEST--
-+RdKafka\Conf::setDefaultTopicConf()
-+--SKIPIF--
-+<?php
-+if (!method_exists('RdKafka\Conf', 'setDefaultTopicConf') || 8 > PHP_MAJOR_VERSION) {
-+ echo "skip";
-+}
-+?>
-+--FILE--
-+<?php
-+
-+$conf = new RdKafka\Conf();
-+
-+echo "Setting valid topic conf\n";
-+$conf->setDefaultTopicConf(new RdKafka\TopicConf());
-+
-+echo "Setting invalid topic conf\n";
-+try {
-+ $conf->setDefaultTopicConf($conf);
-+} catch(TypeError $error) {
-+ echo $error->getMessage() . PHP_EOL;
-+ echo $error->getFile() . PHP_EOL;
-+ echo $error->getLine() . PHP_EOL;
-+ echo $error->getCode();
-+}
-+
-+--EXPECTF--
-+Setting valid topic conf
-+
-+Deprecated: Method RdKafka\Conf::setDefaultTopicConf() is deprecated in %s%econf_setDefaultTopicConf8.php on line 6
-+Setting invalid topic conf
-+
-+Deprecated: Method RdKafka\Conf::setDefaultTopicConf() is deprecated in %s%econf_setDefaultTopicConf8.php on line 10
-+RdKafka\Conf::setDefaultTopicConf(): Argument #1 ($topic_conf) must be of type RdKafka\TopicConf, RdKafka\Conf given
-+%s%econf_setDefaultTopicConf8.php
-+10
-+0
-+
-diff --git a/tests/message_headers.phpt b/tests/message_headers.phpt
-index 61436ae..a244089 100644
---- a/tests/message_headers.phpt
-+++ b/tests/message_headers.phpt
-@@ -15,13 +15,16 @@ $conf->setErrorCb(function ($producer, $err, $errstr) {
- printf("%s: %s\n", rd_kafka_err2str($err), $errstr);
- exit;
- });
-+$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-+
-+$consumer = new RdKafka\Consumer($conf);
-+
- $conf->setDrMsgCb(function ($producer, $msg) use (&$delivered) {
- if ($msg->err) {
- throw new Exception("Message delivery failed: " . $msg->errstr());
- }
- $delivered++;
- });
--$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-
- $producer = new RdKafka\Producer($conf);
-
-@@ -57,8 +60,6 @@ while ($producer->getOutQLen()) {
-
- printf("%d messages delivered\n", $delivered);
-
--$consumer = new RdKafka\Consumer($conf);
--
- $topic = $consumer->newTopic($topicName);
- $topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);
-
-diff --git a/tests/produce_consume.phpt b/tests/produce_consume.phpt
-index c10ed1e..9f87208 100644
---- a/tests/produce_consume.phpt
-+++ b/tests/produce_consume.phpt
-@@ -17,13 +17,17 @@ $conf->setErrorCb(function ($producer, $err, $errstr) {
- printf("%s: %s\n", rd_kafka_err2str($err), $errstr);
- exit;
- });
-+
-+$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-+
-+$consumer = new RdKafka\Consumer($conf);
-+
- $conf->setDrMsgCb(function ($producer, $msg) use (&$delivered) {
- if ($msg->err) {
- throw new Exception("Message delivery failed: " . $msg->errstr());
- }
- $delivered++;
- });
--$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-
- $producer = new RdKafka\Producer($conf);
-
-@@ -46,8 +50,6 @@ while ($producer->getOutQLen()) {
-
- printf("%d messages delivered\n", $delivered);
-
--$consumer = new RdKafka\Consumer($conf);
--
- $topic = $consumer->newTopic($topicName);
- $topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);
-
-diff --git a/tests/produce_consume_queue.phpt b/tests/produce_consume_queue.phpt
-index 9e3dda1..275daf7 100644
---- a/tests/produce_consume_queue.phpt
-+++ b/tests/produce_consume_queue.phpt
-@@ -10,8 +10,6 @@ require __DIR__ . '/integration-tests-check.php';
- $delivered = 0;
-
- $conf = new RdKafka\Conf();
--// Required to detect actual reaching of partition EOF for both topics
--$conf->set('enable.partition.eof', 'true');
- if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) {
- $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION'));
- }
-@@ -53,6 +51,19 @@ while ($producer->getOutQLen()) {
-
- printf("%d messages delivered\n", $delivered);
-
-+$conf = new RdKafka\Conf();
-+// Required to detect actual reaching of partition EOF for both topics
-+$conf->set('enable.partition.eof', 'true');
-+if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) {
-+ $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION'));
-+}
-+$conf->setErrorCb(function ($producer, $err, $errstr) {
-+ printf("%s: %s\n", rd_kafka_err2str($err), $errstr);
-+ exit;
-+});
-+
-+$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
-+
- $consumer = new RdKafka\Consumer($conf);
-
- $queue = $consumer->newQueue();
-diff --git a/topic.c b/topic.c
-index 63ae06a..bc274d6 100644
---- a/topic.c
-+++ b/topic.c
-@@ -43,34 +43,32 @@ typedef struct _php_callback {
- zend_fcall_info_cache fcc;
- } php_callback;
-
--static void kafka_topic_free(zend_object *object TSRMLS_DC) /* {{{ */
-+static void kafka_topic_free(zend_object *object) /* {{{ */
- {
-- kafka_topic_object *intern = get_custom_object(kafka_topic_object, object);
-+ kafka_topic_object *intern = php_kafka_from_obj(kafka_topic_object, object);
-
-- if (ZE_ISDEF(intern->zrk) && intern->rkt) {
-- kafka_object *kafka_intern = get_kafka_object(P_ZEVAL(intern->zrk) TSRMLS_CC);
-+ if (Z_TYPE(intern->zrk) != IS_UNDEF && intern->rkt) {
-+ kafka_object *kafka_intern = get_kafka_object(&intern->zrk);
- if (kafka_intern) {
- zend_hash_index_del(&kafka_intern->topics, (zend_ulong)intern);
- }
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value kafka_topic_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *kafka_topic_new(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- kafka_topic_object *intern;
-
-- intern = alloc_object(intern, class_type);
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ intern = zend_object_alloc(sizeof(*intern), class_type);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, kafka_topic_free, NULL);
-- SET_OBJECT_HANDLERS(retval, &object_handlers);
-+ retval = &intern->std;
-+ retval->handlers = &object_handlers;
-
- return retval;
- }
-@@ -80,8 +78,7 @@ static zend_object_value kafka_topic_new(zend_class_entry *class_type TSRMLS_DC)
- static void consume_callback(rd_kafka_message_t *msg, void *opaque)
- {
- php_callback *cb = (php_callback*) opaque;
-- zeval args[1];
-- TSRMLS_FETCH();
-+ zval args[1];
-
- if (!opaque) {
- return;
-@@ -91,21 +88,21 @@ static void consume_callback(rd_kafka_message_t *msg, void *opaque)
- return;
- }
-
-- MAKE_STD_ZEVAL(args[0]);
-+ ZVAL_NULL(&args[0]);
-
-- kafka_message_new(P_ZEVAL(args[0]), msg TSRMLS_CC);
-+ kafka_message_new(&args[0], msg);
-
-- rdkafka_call_function(&cb->fci, &cb->fcc, NULL, 1, args TSRMLS_CC);
-+ rdkafka_call_function(&cb->fci, &cb->fcc, NULL, 1, args);
-
- zval_ptr_dtor(&args[0]);
- }
-
--kafka_topic_object * get_kafka_topic_object(zval *zrkt TSRMLS_DC)
-+kafka_topic_object * get_kafka_topic_object(zval *zrkt)
- {
-- kafka_topic_object *orkt = get_custom_object_zval(kafka_topic_object, zrkt);
-+ kafka_topic_object *orkt = Z_RDKAFKA_P(kafka_topic_object, zrkt);
-
- if (!orkt->rkt) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\Topic::__construct() has not been called" TSRMLS_CC);
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\Topic::__construct() has not been called");
- return NULL;
- }
-
-@@ -128,21 +125,21 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeCallback)
- long result;
- kafka_topic_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llf", &partition, &timeout_ms, &cb.fci, &cb.fcc) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llf", &partition, &timeout_ms, &cb.fci, &cb.fcc) == FAILURE) {
- return;
- }
-
- if (partition < 0 || partition > 0x7FFFFFFF) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-
-- Z_ADDREF_P(P_ZEVAL(cb.fci.function_name));
-+ Z_ADDREF_P(&cb.fci.function_name);
-
- result = rd_kafka_consume_callback(intern->rkt, partition, timeout_ms, consume_callback, &cb);
-
-@@ -172,26 +169,26 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeQueueStart)
- rd_kafka_resp_err_t err;
- kafka_object *kafka_intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llO", &partition, &offset, &zrkqu, ce_kafka_queue) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llO", &partition, &offset, &zrkqu, ce_kafka_queue) == FAILURE) {
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-
-- queue_intern = get_kafka_queue_object(zrkqu TSRMLS_CC);
-+ queue_intern = get_kafka_queue_object(zrkqu);
- if (!queue_intern) {
- return;
- }
-
-- kafka_intern = get_kafka_object(P_ZEVAL(intern->zrk) TSRMLS_CC);
-+ kafka_intern = get_kafka_object(&intern->zrk);
- if (!kafka_intern) {
- return;
- }
-@@ -199,7 +196,7 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeQueueStart)
- if (is_consuming_toppar(kafka_intern, intern->rkt, partition)) {
- zend_throw_exception_ex(
- ce_kafka_exception,
-- 0 TSRMLS_CC,
-+ 0,
- "%s:" ZEND_LONG_FMT " is already being consumed by the same Consumer instance",
- rd_kafka_topic_name(intern->rkt),
- partition
-@@ -211,7 +208,7 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeQueueStart)
-
- if (ret == -1) {
- err = rd_kafka_last_error();
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-@@ -236,21 +233,21 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeStart)
- rd_kafka_resp_err_t err;
- kafka_object *kafka_intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &partition, &offset) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &partition, &offset) == FAILURE) {
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-
-- kafka_intern = get_kafka_object(P_ZEVAL(intern->zrk) TSRMLS_CC);
-+ kafka_intern = get_kafka_object(&intern->zrk);
- if (!kafka_intern) {
- return;
- }
-@@ -258,7 +255,7 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeStart)
- if (is_consuming_toppar(kafka_intern, intern->rkt, partition)) {
- zend_throw_exception_ex(
- ce_kafka_exception,
-- 0 TSRMLS_CC,
-+ 0,
- "%s:" ZEND_LONG_FMT " is already being consumed by the same Consumer instance",
- rd_kafka_topic_name(intern->rkt),
- partition
-@@ -270,7 +267,7 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeStart)
-
- if (ret == -1) {
- err = rd_kafka_last_error();
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-@@ -293,21 +290,21 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeStop)
- rd_kafka_resp_err_t err;
- kafka_object *kafka_intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &partition) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &partition) == FAILURE) {
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-
-- kafka_intern = get_kafka_object(P_ZEVAL(intern->zrk) TSRMLS_CC);
-+ kafka_intern = get_kafka_object(&intern->zrk);
- if (!kafka_intern) {
- return;
- }
-@@ -316,7 +313,7 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeStop)
-
- if (ret == -1) {
- err = rd_kafka_last_error();
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-@@ -340,16 +337,16 @@ PHP_METHOD(RdKafka__ConsumerTopic, consume)
- rd_kafka_message_t *message;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &partition, &timeout_ms) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &partition, &timeout_ms) == FAILURE) {
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-@@ -361,11 +358,11 @@ PHP_METHOD(RdKafka__ConsumerTopic, consume)
- if (err == RD_KAFKA_RESP_ERR__TIMED_OUT) {
- return;
- }
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
-- kafka_message_new(return_value, message TSRMLS_CC);
-+ kafka_message_new(return_value, message);
-
- rd_kafka_message_destroy(message);
- }
-@@ -388,21 +385,21 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeBatch)
- rd_kafka_message_t **rkmessages;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &partition, &timeout_ms, &batch_size) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &partition, &timeout_ms, &batch_size) == FAILURE) {
- return;
- }
-
- if (0 >= batch_size) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for batch_size", batch_size TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for batch_size", batch_size);
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-@@ -414,12 +411,12 @@ PHP_METHOD(RdKafka__ConsumerTopic, consumeBatch)
- if (result == -1) {
- free(rkmessages);
- err = rd_kafka_last_error();
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
-
- if (result >= 0) {
-- kafka_message_list_to_array(return_value, rkmessages, result TSRMLS_CC);
-+ kafka_message_list_to_array(return_value, rkmessages, result);
- for (i = 0; i < result; ++i) {
- rd_kafka_message_destroy(rkmessages[i]);
- }
-@@ -443,16 +440,16 @@ PHP_METHOD(RdKafka__ConsumerTopic, offsetStore)
- zend_long offset;
- rd_kafka_resp_err_t err;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &partition, &offset) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &partition, &offset) == FAILURE) {
- return;
- }
-
- if (partition < 0 || partition > 0x7FFFFFFF) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-@@ -460,7 +457,7 @@ PHP_METHOD(RdKafka__ConsumerTopic, offsetStore)
- err = rd_kafka_offset_store(intern->rkt, partition, offset);
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -502,34 +499,34 @@ PHP_METHOD(RdKafka__ProducerTopic, produce)
- zend_long partition;
- zend_long msgflags;
- char *payload = NULL;
-- arglen_t payload_len = 0;
-+ size_t payload_len = 0;
- char *key = NULL;
-- arglen_t key_len = 0;
-+ size_t key_len = 0;
- int ret;
- rd_kafka_resp_err_t err;
- kafka_topic_object *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|s!s!", &partition, &msgflags, &payload, &payload_len, &key, &key_len) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|s!s!", &partition, &msgflags, &payload, &payload_len, &key, &key_len) == FAILURE) {
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
- if (msgflags != 0 && msgflags != RD_KAFKA_MSG_F_BLOCK) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Invalid value '%ld' for $msgflags", msgflags TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid value '%ld' for $msgflags", msgflags);
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
-
- ret = rd_kafka_produce(intern->rkt, partition, msgflags | RD_KAFKA_MSG_F_COPY, payload, payload_len, key, key_len, NULL);
-
- if (ret == -1) {
- err = rd_kafka_last_error();
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -553,31 +550,31 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
- zend_long partition;
- zend_long msgflags;
- char *payload = NULL;
-- arglen_t payload_len = 0;
-+ size_t payload_len = 0;
- char *key = NULL;
-- arglen_t key_len = 0;
-+ size_t key_len = 0;
- rd_kafka_resp_err_t err;
- kafka_topic_object *intern;
- kafka_object *kafka_intern;
- HashTable *headersParam = NULL;
- HashPosition headersParamPos;
- char *header_key;
-- zeval *header_value;
-+ zval *header_value;
- rd_kafka_headers_t *headers;
- zend_long timestamp_ms = 0;
- zend_bool timestamp_ms_is_null = 0;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|s!s!h!l!", &partition, &msgflags, &payload, &payload_len, &key, &key_len, &headersParam, &timestamp_ms, &timestamp_ms_is_null) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|s!s!h!l!", &partition, &msgflags, &payload, &payload_len, &key, &key_len, &headersParam, &timestamp_ms, &timestamp_ms_is_null) == FAILURE) {
- return;
- }
-
- if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Out of range value '%ld' for $partition", partition TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition);
- return;
- }
-
- if (msgflags != 0 && msgflags != RD_KAFKA_MSG_F_BLOCK) {
-- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Invalid value '%ld' for $msgflags", msgflags TSRMLS_CC);
-+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid value '%ld' for $msgflags", msgflags);
- return;
- }
-
-@@ -585,12 +582,12 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
- timestamp_ms = 0;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
-
- if (headersParam != NULL && zend_hash_num_elements(headersParam) > 0) {
- headers = rd_kafka_headers_new(zend_hash_num_elements(headersParam));
- for (zend_hash_internal_pointer_reset_ex(headersParam, &headersParamPos);
-- (header_value = rdkafka_hash_get_current_data_ex(headersParam, &headersParamPos)) != NULL &&
-+ (header_value = zend_hash_get_current_data_ex(headersParam, &headersParamPos)) != NULL &&
- (header_key = rdkafka_hash_get_current_key_ex(headersParam, &headersParamPos)) != NULL;
- zend_hash_move_forward_ex(headersParam, &headersParamPos)) {
- convert_to_string_ex(header_value);
-@@ -598,15 +595,15 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
- headers,
- header_key,
- -1, // Auto detect header title length
-- Z_STRVAL_P(ZEVAL(header_value)),
-- Z_STRLEN_P(ZEVAL(header_value))
-+ Z_STRVAL_P(header_value),
-+ Z_STRLEN_P(header_value)
- );
- }
- } else {
- headers = rd_kafka_headers_new(0);
- }
-
-- kafka_intern = get_kafka_object(P_ZEVAL(intern->zrk) TSRMLS_CC);
-+ kafka_intern = get_kafka_object(&intern->zrk);
- if (!kafka_intern) {
- return;
- }
-@@ -625,7 +622,7 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
-
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
- rd_kafka_headers_destroy(headers);
-- zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err TSRMLS_CC);
-+ zend_throw_exception(ce_kafka_exception, rd_kafka_err2str(err), err);
- return;
- }
- }
-@@ -654,12 +651,12 @@ PHP_METHOD(RdKafka__Topic, getName)
- return;
- }
-
-- intern = get_kafka_topic_object(getThis() TSRMLS_CC);
-+ intern = get_kafka_topic_object(getThis());
- if (!intern) {
- return;
- }
-
-- RDKAFKA_RETURN_STRING(rd_kafka_topic_name(intern->rkt));
-+ RETURN_STRING(rd_kafka_topic_name(intern->rkt));
- }
- /* }}} */
-
-@@ -668,26 +665,26 @@ static const zend_function_entry kafka_topic_fe[] = {
- PHP_FE_END
- };
-
--void kafka_topic_minit(TSRMLS_D) { /* {{{ */
-+void kafka_topic_minit(INIT_FUNC_ARGS) { /* {{{ */
-
- zend_class_entry ce;
-
- memcpy(&object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- object_handlers.clone_obj = NULL;
-- set_object_handler_free_obj(&object_handlers, kafka_topic_free);
-- set_object_handler_offset(&object_handlers, XtOffsetOf(kafka_topic_object, std));
-+ object_handlers.free_obj = kafka_topic_free;
-+ object_handlers.offset = XtOffsetOf(kafka_topic_object, std);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Topic", kafka_topic_fe);
-- ce_kafka_topic = zend_register_internal_class(&ce TSRMLS_CC);
-+ ce_kafka_topic = zend_register_internal_class(&ce);
- ce_kafka_topic->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
- ce_kafka_topic->create_object = kafka_topic_new;
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "ConsumerTopic", kafka_consumer_topic_fe);
-- ce_kafka_consumer_topic = rdkafka_register_internal_class_ex(&ce, ce_kafka_topic TSRMLS_CC);
-+ ce_kafka_consumer_topic = zend_register_internal_class_ex(&ce, ce_kafka_topic);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "KafkaConsumerTopic", kafka_kafka_consumer_topic_fe);
-- ce_kafka_kafka_consumer_topic = rdkafka_register_internal_class_ex(&ce, ce_kafka_topic TSRMLS_CC);
-+ ce_kafka_kafka_consumer_topic = zend_register_internal_class_ex(&ce, ce_kafka_topic);
-
- INIT_NS_CLASS_ENTRY(ce, "RdKafka", "ProducerTopic", kafka_producer_topic_fe);
-- ce_kafka_producer_topic = rdkafka_register_internal_class_ex(&ce, ce_kafka_topic TSRMLS_CC);
-+ ce_kafka_producer_topic = zend_register_internal_class_ex(&ce, ce_kafka_topic);
- } /* }}} */
-diff --git a/topic.h b/topic.h
-index 07f49ae..4e712e9 100644
---- a/topic.h
-+++ b/topic.h
-@@ -16,21 +16,14 @@
- +----------------------------------------------------------------------+
- */
-
--#include "zeval.h"
--
- typedef struct _kafka_topic_object {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- rd_kafka_topic_t *rkt;
-- zeval zrk;
--#if PHP_MAJOR_VERSION >= 7
-+ zval zrk;
- zend_object std;
--#endif
- } kafka_topic_object;
-
--void kafka_topic_minit(TSRMLS_D);
--kafka_topic_object * get_kafka_topic_object(zval *zrkt TSRMLS_DC);
-+void kafka_topic_minit(INIT_FUNC_ARGS);
-+kafka_topic_object * get_kafka_topic_object(zval *zrkt);
-
- extern zend_class_entry * ce_kafka_consumer_topic;
- extern zend_class_entry * ce_kafka_kafka_consumer_topic;
-diff --git a/topic_partition.c b/topic_partition.c
-index 2e6d334..9d1b1f7 100644
---- a/topic_partition.c
-+++ b/topic_partition.c
-@@ -29,64 +29,61 @@
- #include "Zend/zend_exceptions.h"
- #include "ext/spl/spl_exceptions.h"
- #include "topic_partition.h"
--#include "zeval.h"
-
- typedef kafka_topic_partition_intern object_intern;
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC);
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp);
-
- zend_class_entry * ce_kafka_topic_partition;
-
- static zend_object_handlers handlers;
-
--static void free_object(zend_object *object TSRMLS_DC) /* {{{ */
-+static void free_object(zend_object *object) /* {{{ */
- {
-- object_intern *intern = get_custom_object(object_intern, object);
-+ object_intern *intern = php_kafka_from_obj(object_intern, object);
-
- if (intern->topic) {
- efree(intern->topic);
- }
-
-- zend_object_std_dtor(&intern->std TSRMLS_CC);
--
-- free_custom_object(intern);
-+ zend_object_std_dtor(&intern->std);
- }
- /* }}} */
-
--static zend_object_value create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
-+static zend_object *create_object(zend_class_entry *class_type) /* {{{ */
- {
-- zend_object_value retval;
-+ zend_object* retval;
- object_intern *intern;
-
- intern = ecalloc(1, sizeof(*intern));
-- zend_object_std_init(&intern->std, class_type TSRMLS_CC);
-+ zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
-- STORE_OBJECT(retval, intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_object, NULL);
-- SET_OBJECT_HANDLERS(retval, &handlers);
-+ retval = &intern->std;
-+ retval->handlers = &handlers;
-
- return retval;
- }
- /* }}} */
-
--static object_intern * get_object(zval *z TSRMLS_DC) /* {{{ */
-+static object_intern * get_object(zval *z) /* {{{ */
- {
-- object_intern * intern = get_custom_object_zval(object_intern, z);
-+ object_intern *intern = Z_RDKAFKA_P(object_intern, z);
-
- if (!intern->topic) {
-- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "RdKafka\\TopicPartition::__construct() has not been called");
-+ zend_throw_exception_ex(NULL, 0, "RdKafka\\TopicPartition::__construct() has not been called");
- return NULL;
- }
-
- return intern;
- } /* }}} */
-
--kafka_topic_partition_intern * get_topic_partition_object(zval *z TSRMLS_DC) /* {{{ */
-+kafka_topic_partition_intern * get_topic_partition_object(zval *z) /* {{{ */
- {
-- return get_object(z TSRMLS_CC);
-+ return get_object(z);
- } /* }}} */
-
--static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-+static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */
- {
- zval ary;
- object_intern *intern;
-@@ -95,13 +92,14 @@ static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
-
- array_init(&ary);
-
-- intern = get_object(object TSRMLS_CC);
-+ intern = rdkafka_get_debug_object(object_intern, object);
-+
- if (!intern) {
- return Z_ARRVAL(ary);
- }
-
- if (intern->topic) {
-- rdkafka_add_assoc_string(&ary, "topic", intern->topic);
-+ add_assoc_string(&ary, "topic", intern->topic);
- } else {
- add_assoc_null(&ary, "topic");
- }
-@@ -113,11 +111,11 @@ static HashTable *get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
- }
- /* }}} */
-
--void kafka_topic_partition_init(zval *zobj, char * topic, int32_t partition, int64_t offset TSRMLS_DC) /* {{{ */
-+void kafka_topic_partition_init(zval *zobj, char * topic, int32_t partition, int64_t offset) /* {{{ */
- {
- object_intern *intern;
-
-- intern = get_custom_object_zval(object_intern, zobj);
-+ intern = Z_RDKAFKA_P(object_intern, zobj);
- if (!intern) {
- return;
- }
-@@ -131,51 +129,51 @@ void kafka_topic_partition_init(zval *zobj, char * topic, int32_t partition, int
- intern->offset = offset;
- } /* }}} */
-
--void kafka_topic_partition_list_to_array(zval *return_value, rd_kafka_topic_partition_list_t *list TSRMLS_DC) /* {{{ */
-+void kafka_topic_partition_list_to_array(zval *return_value, rd_kafka_topic_partition_list_t *list) /* {{{ */
- {
- rd_kafka_topic_partition_t *topar;
-- zeval ztopar;
-+ zval ztopar;
- int i;
-
- array_init_size(return_value, list->cnt);
-
- for (i = 0; i < list->cnt; i++) {
- topar = &list->elems[i];
-- MAKE_STD_ZEVAL(ztopar);
-- object_init_ex(P_ZEVAL(ztopar), ce_kafka_topic_partition);
-- kafka_topic_partition_init(P_ZEVAL(ztopar), topar->topic, topar->partition, topar->offset TSRMLS_CC);
-- add_next_index_zval(return_value, P_ZEVAL(ztopar));
-+ ZVAL_NULL(&ztopar);
-+ object_init_ex(&ztopar, ce_kafka_topic_partition);
-+ kafka_topic_partition_init(&ztopar, topar->topic, topar->partition, topar->offset);
-+ add_next_index_zval(return_value, &ztopar);
- }
- } /* }}} */
-
--rd_kafka_topic_partition_list_t * array_arg_to_kafka_topic_partition_list(int argnum, HashTable *ary TSRMLS_DC) { /* {{{ */
-+rd_kafka_topic_partition_list_t * array_arg_to_kafka_topic_partition_list(int argnum, HashTable *ary) { /* {{{ */
-
- HashPosition pos;
- rd_kafka_topic_partition_list_t *list;
-- zeval *zv;
-+ zval *zv;
-
- list = rd_kafka_topic_partition_list_new(zend_hash_num_elements(ary));
-
- for (zend_hash_internal_pointer_reset_ex(ary, &pos);
-- (zv = rdkafka_hash_get_current_data_ex(ary, &pos)) != NULL;
-+ (zv = zend_hash_get_current_data_ex(ary, &pos)) != NULL;
- zend_hash_move_forward_ex(ary, &pos)) {
- kafka_topic_partition_intern *topar_intern;
- rd_kafka_topic_partition_t *topar;
-
-- if (Z_TYPE_P(ZEVAL(zv)) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(ZEVAL(zv)), ce_kafka_topic_partition TSRMLS_CC)) {
-+ if (Z_TYPE_P(zv) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(zv), ce_kafka_topic_partition)) {
- const char *space;
-- const char *class_name = get_active_class_name(&space TSRMLS_CC);
-+ const char *class_name = get_active_class_name(&space);
- rd_kafka_topic_partition_list_destroy(list);
- php_error(E_ERROR,
- "Argument %d passed to %s%s%s() must be an array of RdKafka\\TopicPartition, at least one element is a(n) %s",
- argnum,
- class_name, space,
-- get_active_function_name(TSRMLS_C),
-- zend_zval_type_name(ZEVAL(zv)));
-+ get_active_function_name(),
-+ zend_zval_type_name(zv));
- return NULL;
- }
-
-- topar_intern = get_topic_partition_object(ZEVAL(zv) TSRMLS_CC);
-+ topar_intern = get_topic_partition_object(zv);
- if (!topar_intern) {
- rd_kafka_topic_partition_list_destroy(list);
- return NULL;
-@@ -201,21 +199,21 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__TopicPartition, __construct)
- {
- char *topic;
-- arglen_t topic_len;
-+ size_t topic_len;
- zend_long partition;
- zend_long offset = 0;
- zend_error_handling error_handling;
-
-- zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
-+ zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &topic, &topic_len, &partition, &offset) == FAILURE) {
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l", &topic, &topic_len, &partition, &offset) == FAILURE) {
-+ zend_restore_error_handling(&error_handling);
- return;
- }
-
-- kafka_topic_partition_init(getThis(), topic, partition, offset TSRMLS_CC);
-+ kafka_topic_partition_init(getThis(), topic, partition, offset);
-
-- zend_restore_error_handling(&error_handling TSRMLS_CC);
-+ zend_restore_error_handling(&error_handling);
- }
- /* }}} */
-
-@@ -233,13 +231,13 @@ PHP_METHOD(RdKafka__TopicPartition, getTopic)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-
- if (intern->topic) {
-- RDKAFKA_RETURN_STRING(intern->topic);
-+ RETURN_STRING(intern->topic);
- } else {
- RETURN_NULL();
- }
-@@ -256,14 +254,14 @@ ZEND_END_ARG_INFO()
- PHP_METHOD(RdKafka__TopicPartition, setTopic)
- {
- char * topic;
-- arglen_t topic_len;
-+ size_t topic_len;
- object_intern *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &topic, &topic_len) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &topic, &topic_len) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -292,7 +290,7 @@ PHP_METHOD(RdKafka__TopicPartition, getPartition)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -313,11 +311,11 @@ PHP_METHOD(RdKafka__TopicPartition, setPartition)
- zend_long partition;
- object_intern *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &partition) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &partition) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -342,7 +340,7 @@ PHP_METHOD(RdKafka__TopicPartition, getOffset)
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -363,11 +361,11 @@ PHP_METHOD(RdKafka__TopicPartition, setOffset)
- zend_long offset;
- object_intern *intern;
-
-- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &offset) == FAILURE) {
-+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &offset) == FAILURE) {
- return;
- }
-
-- intern = get_object(getThis() TSRMLS_CC);
-+ intern = get_object(getThis());
- if (!intern) {
- return;
- }
-@@ -389,16 +387,16 @@ static const zend_function_entry fe[] = { /* {{{ */
- PHP_FE_END
- }; /* }}} */
-
--void kafka_metadata_topic_partition_minit(TSRMLS_D) /* {{{ */
-+void kafka_metadata_topic_partition_minit(INIT_FUNC_ARGS) /* {{{ */
- {
- zend_class_entry tmpce;
-
- INIT_NS_CLASS_ENTRY(tmpce, "RdKafka", "TopicPartition", fe);
-- ce_kafka_topic_partition = zend_register_internal_class(&tmpce TSRMLS_CC);
-+ ce_kafka_topic_partition = zend_register_internal_class(&tmpce);
- ce_kafka_topic_partition->create_object = create_object;
-
- handlers = kafka_default_object_handlers;
- handlers.get_debug_info = get_debug_info;
-- set_object_handler_free_obj(&handlers, free_object);
-- set_object_handler_offset(&handlers, XtOffsetOf(object_intern, std));
-+ handlers.free_obj = free_object;
-+ handlers.offset = XtOffsetOf(object_intern, std);
- } /* }}} */
-diff --git a/topic_partition.h b/topic_partition.h
-index cbc0f43..f2d405d 100644
---- a/topic_partition.h
-+++ b/topic_partition.h
-@@ -17,23 +17,18 @@
- */
-
- typedef struct _kafka_topic_partition_intern {
--#if PHP_MAJOR_VERSION < 7
-- zend_object std;
--#endif
- char *topic;
- int32_t partition;
- int64_t offset;
--#if PHP_MAJOR_VERSION >= 7
- zend_object std;
--#endif
- } kafka_topic_partition_intern;
-
--void kafka_metadata_topic_partition_minit(TSRMLS_D);
-+void kafka_metadata_topic_partition_minit(INIT_FUNC_ARGS);
-
--kafka_topic_partition_intern * get_topic_partition_object(zval *z TSRMLS_DC);
--void kafka_topic_partition_init(zval *z, char *topic, int32_t partition, int64_t offset TSRMLS_DC);
-+kafka_topic_partition_intern * get_topic_partition_object(zval *z);
-+void kafka_topic_partition_init(zval *z, char *topic, int32_t partition, int64_t offset);
-
--void kafka_topic_partition_list_to_array(zval *return_value, rd_kafka_topic_partition_list_t *list TSRMLS_DC);
--rd_kafka_topic_partition_list_t * array_arg_to_kafka_topic_partition_list(int argnum, HashTable *ary TSRMLS_DC);
-+void kafka_topic_partition_list_to_array(zval *return_value, rd_kafka_topic_partition_list_t *list);
-+rd_kafka_topic_partition_list_t * array_arg_to_kafka_topic_partition_list(int argnum, HashTable *ary);
-
- extern zend_class_entry * ce_kafka_topic_partition;