diff --git a/.appveyor.yml b/.appveyor.yml index bbde51de..99f35ec1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,35 +8,37 @@ environment: BIN_SDK_VER: 2.2.0 DEP: librdkafka-1.5.3 matrix: - - PHP_VER: 7.4 + - PHP_VER: 8.1 TS: 0 - VC: vc15 + VC: vs16 ARCH: x64 OPCACHE: 0 - - PHP_VER: 7.4 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - PHP_VER: 8.1 TS: 1 - VC: vc15 + VC: vs16 ARCH: x64 OPCACHE: 1 - - PHP_VER: 8.0 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - PHP_VER: 8.2 TS: 0 VC: vs16 ARCH: x64 OPCACHE: 0 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - PHP_VER: 8.0 + - PHP_VER: 8.2 TS: 1 VC: vs16 ARCH: x64 OPCACHE: 1 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - PHP_VER: 8.1 + - PHP_VER: 8.3 TS: 0 VC: vs16 ARCH: x64 OPCACHE: 0 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - PHP_VER: 8.1 + - PHP_VER: 8.3 TS: 1 VC: vs16 ARCH: x64 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 955b3e4c..d5209ad4 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -6,7 +6,7 @@ on: jobs: package: name: 'Package' - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-24.04' steps: - name: 'Check out repository' uses: 'actions/checkout@v2' @@ -14,7 +14,7 @@ jobs: path: 'php-rdkafka' - name: 'Install dependencies' - run: 'sudo apt-get -y install php7.4-dev librdkafka-dev' + run: 'sudo apt-get -y install php-dev librdkafka-dev' - name: 'Package and verify package' run: './php-rdkafka/.github/workflows/package/package.sh' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d986c660..fad7bbda 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,13 +17,13 @@ jobs: include: # Latest librdkafka 2.x with memcheck - php: '8.3.0' - librdkafka: 'v1.9.2' + librdkafka: 'v2.6.0' memcheck: '1' - php: '8.2.0' - librdkafka: 'v1.9.2' + librdkafka: 'v2.6.0' memcheck: '1' - php: '8.1.0' - librdkafka: 'v1.9.2' + librdkafka: 'v2.6.0' memcheck: '1' # Latest librdkafka 1.x with memcheck @@ -36,17 +36,14 @@ jobs: - php: '8.1.0' librdkafka: 'v1.9.2' memcheck: '1' - - php: '8.0.0' - librdkafka: 'v1.9.2' - memcheck: '1' # Latest librdkafka 2.x - php: '8.3.0' - librdkafka: 'v2.3.0' + librdkafka: 'v2.6.0' - php: '8.2.0' - librdkafka: 'v2.3.0' + librdkafka: 'v2.6.0' - php: '8.1.0' - librdkafka: 'v2.3.0' + librdkafka: 'v2.6.0' # Latest librdkafka 1.x - php: '8.3.0' @@ -55,12 +52,6 @@ jobs: librdkafka: 'v1.9.2' - php: '8.1.0' librdkafka: 'v1.9.2' - - php: '8.0.0' - librdkafka: 'v1.9.2' - - php: '7.4.0' - librdkafka: 'v1.9.2' - - php: '7.3.0' - librdkafka: 'v1.9.2' # librdkafka 1.7.0 - php: '8.3.0' @@ -69,79 +60,10 @@ jobs: librdkafka: 'v1.7.0' - php: '8.1.0' librdkafka: 'v1.7.0' - - php: '8.0.0' - librdkafka: 'v1.7.0' - - php: '7.4.0' - librdkafka: 'v1.7.0' - - php: '7.3.0' - librdkafka: 'v1.7.0' # librdkafka 1.6.1 - php: '8.1.0' librdkafka: 'v1.6.1' - - php: '8.0.0' - librdkafka: 'v1.6.1' - - php: '7.4.0' - librdkafka: 'v1.6.1' - - php: '7.3.0' - librdkafka: 'v1.6.1' - - # librdkafka 1.5.3 - - php: '8.1.0' - librdkafka: 'v1.5.3' - - php: '8.0.0' - librdkafka: 'v1.5.3' - - php: '7.4.0' - librdkafka: 'v1.5.3' - - php: '7.3.0' - librdkafka: 'v1.5.3' - - # librdkafka 1.4.4 - - php: '8.1.0' - librdkafka: 'v1.4.4' - - php: '8.0.0' - librdkafka: 'v1.4.4' - - php: '7.4.0' - librdkafka: 'v1.4.4' - - php: '7.3.0' - librdkafka: 'v1.4.4' - - # librdkafka 1.0.1 - - php: '8.1.0' - librdkafka: 'v1.0.1' - skipoauth: '1' - - php: '8.0.0' - librdkafka: 'v1.0.1' - skipoauth: '1' - - php: '7.4.0' - librdkafka: 'v1.0.1' - skipoauth: '1' - - php: '7.3.0' - librdkafka: 'v1.0.1' - skipoauth: '1' - - # librdkafka 0.11.6 - - php: '8.1.0' - librdkafka: 'v0.11.6' - skipoauth: '1' - - php: '8.0.0' - librdkafka: 'v0.11.6' - skipoauth: '1' - - php: '7.4.0' - librdkafka: 'v0.11.6' - skipoauth: '1' - - php: '7.3.0' - librdkafka: 'v0.11.6' - skipoauth: '1' - - php: '7.2.0' - librdkafka: 'v0.11.6' - skipoauth: '1' - - php: '7.1.0' - librdkafka: 'v0.11.6' - skipoauth: '1' - - php: '7.0.0' - librdkafka: 'v0.11.6' - skipoauth: '1' # librdkafka master (experimental, does not block PRs) - php: '8.3.0' @@ -153,15 +75,6 @@ jobs: - php: '8.1.0' librdkafka: 'master' experimental: true - - php: '8.0.0' - librdkafka: 'master' - experimental: true - - php: '7.4.0' - librdkafka: 'master' - experimental: true - - php: '7.3.0' - librdkafka: 'master' - experimental: true runs-on: 'ubuntu-20.04' continue-on-error: ${{ !!matrix.experimental }} diff --git a/.github/workflows/test/build-php.sh b/.github/workflows/test/build-php.sh index e8d4cecc..3c408792 100755 --- a/.github/workflows/test/build-php.sh +++ b/.github/workflows/test/build-php.sh @@ -19,14 +19,7 @@ if ! [ -f ~/build-cache/php/usr/local/bin/php ]; then if [ $MEMORY_CHECK -eq 1 ]; then PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --enable-debug --with-valgrind" else - case $PHP_VERSION in - 8.*) - PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --enable-zts" - ;; - 7.*) - PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --enable-maintainer-zts" - ;; - esac + PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --enable-zts" fi ./configure $PHP_BUILD_FLAGS $PHP_BUILD_EXTRA_FLAGS diff --git a/.gitignore b/.gitignore index 2c2ece86..793488b7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.la *.lo *.swp +*_legacy_arginfo.h .deps .libs Makefile diff --git a/conf.c b/conf.c index 9aa8132f..7ef29dc5 100644 --- a/conf.c +++ b/conf.c @@ -31,11 +31,7 @@ #include "conf.h" #include "topic_partition.h" #include "message.h" -#if PHP_VERSION_ID < 80000 -#include "conf_legacy_arginfo.h" -#else #include "conf_arginfo.h" -#endif zend_class_entry * ce_kafka_conf; zend_class_entry * ce_kafka_topic_conf; @@ -735,7 +731,6 @@ PHP_METHOD(RdKafka_Conf, setLogCb) } /* }}} */ -#ifdef HAS_RD_KAFKA_OAUTHBEARER /* {{{ proto void RdKafka\Conf::setOauthbearerTokenRefreshCb(mixed $callback) Set token refresh callback for OAUTHBEARER sasl */ PHP_METHOD(RdKafka_Conf, setOauthbearerTokenRefreshCb) @@ -767,7 +762,6 @@ PHP_METHOD(RdKafka_Conf, setOauthbearerTokenRefreshCb) rd_kafka_conf_set_oauthbearer_token_refresh_cb(conf->u.conf, kafka_conf_set_oauthbearer_token_refresh_cb); } /* }}} */ -#endif /* {{{ proto RdKafka\TopicConf::__construct() */ PHP_METHOD(RdKafka_TopicConf, __construct) @@ -816,14 +810,12 @@ PHP_METHOD(RdKafka_TopicConf, setPartitioner) case MSG_PARTITIONER_CONSISTENT_RANDOM: partitioner = rd_kafka_msg_partitioner_consistent_random; break; -#ifdef HAS_RD_KAFKA_PARTITIONER_MURMUR2 case MSG_PARTITIONER_MURMUR2: partitioner = rd_kafka_msg_partitioner_murmur2; break; case MSG_PARTITIONER_MURMUR2_RANDOM: partitioner = rd_kafka_msg_partitioner_murmur2_random; break; -#endif default: zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid partitioner given"); return; diff --git a/conf.stub.php b/conf.stub.php index d1ce97e9..ccd84ab1 100644 --- a/conf.stub.php +++ b/conf.stub.php @@ -45,10 +45,8 @@ public function setOffsetCommitCb(callable $callback): void {} /** @tentative-return-type */ public function setLogCb(callable $callback): void {} - #ifdef HAS_RD_KAFKA_OAUTHBEARER /** @tentative-return-type */ public function setOauthbearerTokenRefreshCb(callable $callback): void {} - #endif } class TopicConf diff --git a/conf_arginfo.h b/conf_arginfo.h index d179aee1..9dff8689 100644 --- a/conf_arginfo.h +++ b/conf_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a72d2e1796ed7f89185f543973c659a6a704f347 */ + * Stub hash: 4bdaeef0f9a2a0194b1f800100ff14793cf6980a */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -48,15 +48,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_Conf_setLogCb arginfo_class_RdKafka_Conf_setErrorCb -#if defined(HAS_RD_KAFKA_OAUTHBEARER) -#if (PHP_VERSION_ID >= 80100) -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_Conf_setOauthbearerTokenRefreshCb, 0, 1, IS_VOID, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf_setOauthbearerTokenRefreshCb, 0, 0, 1) -#endif - ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) -ZEND_END_ARG_INFO() -#endif +#define arginfo_class_RdKafka_Conf_setOauthbearerTokenRefreshCb arginfo_class_RdKafka_Conf_setErrorCb #define arginfo_class_RdKafka_TopicConf___construct arginfo_class_RdKafka_Conf___construct @@ -72,6 +64,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicConf_setPartitioner, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, partitioner, IS_LONG, 0) ZEND_END_ARG_INFO() + ZEND_METHOD(RdKafka_Conf, __construct); ZEND_METHOD(RdKafka_Conf, dump); ZEND_METHOD(RdKafka_Conf, set); @@ -83,12 +76,11 @@ ZEND_METHOD(RdKafka_Conf, setRebalanceCb); ZEND_METHOD(RdKafka_Conf, setConsumeCb); ZEND_METHOD(RdKafka_Conf, setOffsetCommitCb); ZEND_METHOD(RdKafka_Conf, setLogCb); -#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_METHOD(RdKafka_Conf, setOauthbearerTokenRefreshCb); -#endif ZEND_METHOD(RdKafka_TopicConf, __construct); ZEND_METHOD(RdKafka_TopicConf, setPartitioner); + static const zend_function_entry class_RdKafka_Conf_methods[] = { ZEND_ME(RdKafka_Conf, __construct, arginfo_class_RdKafka_Conf___construct, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Conf, dump, arginfo_class_RdKafka_Conf_dump, ZEND_ACC_PUBLIC) @@ -101,24 +93,15 @@ static const zend_function_entry class_RdKafka_Conf_methods[] = { ZEND_ME(RdKafka_Conf, setConsumeCb, arginfo_class_RdKafka_Conf_setConsumeCb, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Conf, setOffsetCommitCb, arginfo_class_RdKafka_Conf_setOffsetCommitCb, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Conf, setLogCb, arginfo_class_RdKafka_Conf_setLogCb, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_ME(RdKafka_Conf, setOauthbearerTokenRefreshCb, arginfo_class_RdKafka_Conf_setOauthbearerTokenRefreshCb, ZEND_ACC_PUBLIC) -#endif ZEND_FE_END }; + static const zend_function_entry class_RdKafka_TopicConf_methods[] = { ZEND_ME(RdKafka_TopicConf, __construct, arginfo_class_RdKafka_TopicConf___construct, ZEND_ACC_PUBLIC) -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("dump", zim_RdKafka_Conf_dump, arginfo_class_RdKafka_TopicConf_dump, ZEND_ACC_PUBLIC, NULL, NULL) -#else - ZEND_RAW_FENTRY("dump", zim_RdKafka_Conf_dump, arginfo_class_RdKafka_TopicConf_dump, ZEND_ACC_PUBLIC) -#endif -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("set", zim_RdKafka_Conf_set, arginfo_class_RdKafka_TopicConf_set, ZEND_ACC_PUBLIC, NULL, NULL) -#else - ZEND_RAW_FENTRY("set", zim_RdKafka_Conf_set, arginfo_class_RdKafka_TopicConf_set, ZEND_ACC_PUBLIC) -#endif + ZEND_MALIAS(RdKafka_Conf, dump, dump, arginfo_class_RdKafka_TopicConf_dump, ZEND_ACC_PUBLIC) + ZEND_MALIAS(RdKafka_Conf, set, set, arginfo_class_RdKafka_TopicConf_set, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_TopicConf, setPartitioner, arginfo_class_RdKafka_TopicConf_setPartitioner, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -128,11 +111,7 @@ static zend_class_entry *register_class_RdKafka_Conf(void) zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Conf", class_RdKafka_Conf_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); -#else class_entry = zend_register_internal_class_ex(&ce, NULL); -#endif return class_entry; } @@ -142,11 +121,7 @@ static zend_class_entry *register_class_RdKafka_TopicConf(void) zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "RdKafka", "TopicConf", class_RdKafka_TopicConf_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); -#else class_entry = zend_register_internal_class_ex(&ce, NULL); -#endif return class_entry; } diff --git a/conf_legacy_arginfo.h b/conf_legacy_arginfo.h deleted file mode 100644 index 72305d3b..00000000 --- a/conf_legacy_arginfo.h +++ /dev/null @@ -1,128 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: a72d2e1796ed7f89185f543973c659a6a704f347 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf_dump, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf_set, 0, 0, 2) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf_setDefaultTopicConf, 0, 0, 1) - ZEND_ARG_INFO(0, topic_conf) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf_setErrorCb, 0, 0, 1) - ZEND_ARG_INFO(0, callback) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Conf_setDrMsgCb arginfo_class_RdKafka_Conf_setErrorCb - -#define arginfo_class_RdKafka_Conf_setStatsCb arginfo_class_RdKafka_Conf_setErrorCb - -#define arginfo_class_RdKafka_Conf_setRebalanceCb arginfo_class_RdKafka_Conf_setErrorCb - -#define arginfo_class_RdKafka_Conf_setConsumeCb arginfo_class_RdKafka_Conf_setErrorCb - -#define arginfo_class_RdKafka_Conf_setOffsetCommitCb arginfo_class_RdKafka_Conf_setErrorCb - -#define arginfo_class_RdKafka_Conf_setLogCb arginfo_class_RdKafka_Conf_setErrorCb - -#if defined(HAS_RD_KAFKA_OAUTHBEARER) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Conf_setOauthbearerTokenRefreshCb, 0, 0, 1) - ZEND_ARG_INFO(0, callback) -ZEND_END_ARG_INFO() -#endif - -#define arginfo_class_RdKafka_TopicConf___construct arginfo_class_RdKafka_Conf___construct - -#define arginfo_class_RdKafka_TopicConf_dump arginfo_class_RdKafka_Conf_dump - -#define arginfo_class_RdKafka_TopicConf_set arginfo_class_RdKafka_Conf_set - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicConf_setPartitioner, 0, 0, 1) - ZEND_ARG_INFO(0, partitioner) -ZEND_END_ARG_INFO() - -ZEND_METHOD(RdKafka_Conf, __construct); -ZEND_METHOD(RdKafka_Conf, dump); -ZEND_METHOD(RdKafka_Conf, set); -ZEND_METHOD(RdKafka_Conf, setDefaultTopicConf); -ZEND_METHOD(RdKafka_Conf, setErrorCb); -ZEND_METHOD(RdKafka_Conf, setDrMsgCb); -ZEND_METHOD(RdKafka_Conf, setStatsCb); -ZEND_METHOD(RdKafka_Conf, setRebalanceCb); -ZEND_METHOD(RdKafka_Conf, setConsumeCb); -ZEND_METHOD(RdKafka_Conf, setOffsetCommitCb); -ZEND_METHOD(RdKafka_Conf, setLogCb); -#if defined(HAS_RD_KAFKA_OAUTHBEARER) -ZEND_METHOD(RdKafka_Conf, setOauthbearerTokenRefreshCb); -#endif -ZEND_METHOD(RdKafka_TopicConf, __construct); -ZEND_METHOD(RdKafka_TopicConf, setPartitioner); - -static const zend_function_entry class_RdKafka_Conf_methods[] = { - ZEND_ME(RdKafka_Conf, __construct, arginfo_class_RdKafka_Conf___construct, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, dump, arginfo_class_RdKafka_Conf_dump, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, set, arginfo_class_RdKafka_Conf_set, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setDefaultTopicConf, arginfo_class_RdKafka_Conf_setDefaultTopicConf, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) - ZEND_ME(RdKafka_Conf, setErrorCb, arginfo_class_RdKafka_Conf_setErrorCb, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setDrMsgCb, arginfo_class_RdKafka_Conf_setDrMsgCb, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setStatsCb, arginfo_class_RdKafka_Conf_setStatsCb, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setRebalanceCb, arginfo_class_RdKafka_Conf_setRebalanceCb, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setConsumeCb, arginfo_class_RdKafka_Conf_setConsumeCb, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setOffsetCommitCb, arginfo_class_RdKafka_Conf_setOffsetCommitCb, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Conf, setLogCb, arginfo_class_RdKafka_Conf_setLogCb, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_OAUTHBEARER) - ZEND_ME(RdKafka_Conf, setOauthbearerTokenRefreshCb, arginfo_class_RdKafka_Conf_setOauthbearerTokenRefreshCb, ZEND_ACC_PUBLIC) -#endif - ZEND_FE_END -}; - -static const zend_function_entry class_RdKafka_TopicConf_methods[] = { - ZEND_ME(RdKafka_TopicConf, __construct, arginfo_class_RdKafka_TopicConf___construct, ZEND_ACC_PUBLIC) -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("dump", zim_RdKafka_Conf_dump, arginfo_class_RdKafka_TopicConf_dump, ZEND_ACC_PUBLIC, NULL, NULL) -#else - ZEND_RAW_FENTRY("dump", zim_RdKafka_Conf_dump, arginfo_class_RdKafka_TopicConf_dump, ZEND_ACC_PUBLIC) -#endif -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("set", zim_RdKafka_Conf_set, arginfo_class_RdKafka_TopicConf_set, ZEND_ACC_PUBLIC, NULL, NULL) -#else - ZEND_RAW_FENTRY("set", zim_RdKafka_Conf_set, arginfo_class_RdKafka_TopicConf_set, ZEND_ACC_PUBLIC) -#endif - ZEND_ME(RdKafka_TopicConf, setPartitioner, arginfo_class_RdKafka_TopicConf_setPartitioner, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Conf(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Conf", class_RdKafka_Conf_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); -#else - class_entry = zend_register_internal_class_ex(&ce, NULL); -#endif - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_TopicConf(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "TopicConf", class_RdKafka_TopicConf_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); -#else - class_entry = zend_register_internal_class_ex(&ce, NULL); -#endif - - return class_entry; -} diff --git a/config.m4 b/config.m4 index 356a1df3..73a229a1 100644 --- a/config.m4 +++ b/config.m4 @@ -27,7 +27,7 @@ if test "$PHP_RDKAFKA" != "no"; then PHP_ADD_INCLUDE($RDKAFKA_DIR/include) - SOURCES="rdkafka.c metadata.c metadata_broker.c metadata_topic.c metadata_partition.c metadata_collection.c conf.c topic.c queue.c message.c fun.c kafka_consumer.c topic_partition.c" + SOURCES="rdkafka.c metadata.c metadata_broker.c metadata_topic.c metadata_partition.c metadata_collection.c conf.c topic.c queue.c message.c fun.c kafka_consumer.c topic_partition.c kafka_error_exception.c" LIBNAME=rdkafka LIBSYMBOL=rd_kafka_new @@ -50,54 +50,13 @@ if test "$PHP_RDKAFKA" != "no"; then AC_MSG_CHECKING([for librdkafka version]) AC_EGREP_CPP(yes,[ #include -#if RD_KAFKA_VERSION >= 0x000b0000 +#if RD_KAFKA_VERSION >= 0x010503ff yes #endif ],[ - AC_MSG_RESULT([>= 0.11.0]) + AC_MSG_RESULT([>= 1.5.3]) ],[ - AC_MSG_ERROR([librdkafka version 0.11.0 or greater required.]) - ]) - - AC_CHECK_LIB($LIBNAME,[rd_kafka_message_headers],[ - AC_DEFINE(HAVE_RD_KAFKA_MESSAGE_HEADERS,1,[ ]) - ],[ - AC_MSG_WARN([no rd_kafka_message_headers, headers support will not be available]) - ]) - - AC_CHECK_LIB($LIBNAME,[rd_kafka_purge],[ - AC_DEFINE(HAS_RD_KAFKA_PURGE,1,[ ]) - ],[ - AC_MSG_WARN([purge is not available]) - ]) - - AC_CHECK_LIB($LIBNAME,[rd_kafka_controllerid],[ -#if RD_KAFKA_VERSION >= 0x010000ff - AC_DEFINE(HAS_RD_KAFKA_CONTROLLERID,1,[ ]) -#else - AC_MSG_WARN([controllerid is broken on 0.11.x]) -#endif - ],[ - AC_MSG_WARN([controllerid is not available]) - ]) - - AC_CHECK_LIB($LIBNAME,[rd_kafka_init_transactions],[ - AC_DEFINE(HAS_RD_KAFKA_TRANSACTIONS,1,[ ]) - SOURCES="$SOURCES kafka_error_exception.c" - ],[ - AC_MSG_WARN([transactions are not available]) - ]) - - AC_CHECK_LIB($LIBNAME,[rd_kafka_msg_partitioner_murmur2],[ - AC_DEFINE(HAS_RD_KAFKA_PARTITIONER_MURMUR2,1,[ ]) - ],[ - AC_MSG_WARN([murmur2 partitioner is not available]) - ]) - - AC_CHECK_LIB($LIBNAME,[rd_kafka_oauthbearer_set_token],[ - AC_DEFINE(HAS_RD_KAFKA_OAUTHBEARER,1,[ ]) - ],[ - AC_MSG_WARN([oauthbearer support is not available]) + AC_MSG_ERROR([librdkafka version 1.5.3 or greater required.]) ]) AC_CHECK_LIB($LIBNAME,[rd_kafka_incremental_assign, rd_kafka_incremental_unassign],[ diff --git a/config.w32 b/config.w32 index 812db7bd..fc5ef9ad 100644 --- a/config.w32 +++ b/config.w32 @@ -7,10 +7,6 @@ if (PHP_RDKAFKA != "no") { if (CHECK_LIB("librdkafka.lib", "rdkafka", PHP_RDKAFKA) && CHECK_HEADER_ADD_INCLUDE("librdkafka/rdkafka.h", "CFLAGS_RDKAFKA")) { - AC_DEFINE('HAVE_RD_KAFKA_MESSAGE_HEADERS', 1, ''); - AC_DEFINE('HAS_RD_KAFKA_PURGE', 1, ''); - AC_DEFINE('HAS_RD_KAFKA_TRANSACTIONS', 1, ''); - AC_DEFINE('HAS_RD_KAFKA_PARTITIONER_MURMUR2', 1, ''); EXTENSION("rdkafka", "rdkafka.c metadata.c metadata_broker.c metadata_topic.c \ metadata_partition.c metadata_collection.c conf.c \ topic.c queue.c message.c fun.c kafka_consumer.c topic_partition.c kafka_error_exception.c"); diff --git a/fun_legacy_arginfo.h b/fun_legacy_arginfo.h deleted file mode 100644 index 8cfb2a3d..00000000 --- a/fun_legacy_arginfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0e1e56d853a47168a1f7f0950b674c2de6a91976 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_rd_kafka_get_err_descs, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_rd_kafka_err2name, 0, 0, 1) - ZEND_ARG_INFO(0, err) -ZEND_END_ARG_INFO() - -#define arginfo_rd_kafka_err2str arginfo_rd_kafka_err2name - -ZEND_BEGIN_ARG_INFO_EX(arginfo_rd_kafka_errno2err, 0, 0, 1) - ZEND_ARG_INFO(0, errnox) -ZEND_END_ARG_INFO() - -#define arginfo_rd_kafka_errno arginfo_rd_kafka_get_err_descs - -ZEND_BEGIN_ARG_INFO_EX(arginfo_rd_kafka_offset_tail, 0, 0, 1) - ZEND_ARG_INFO(0, cnt) -ZEND_END_ARG_INFO() - -#define arginfo_rd_kafka_thread_cnt arginfo_rd_kafka_get_err_descs - - -ZEND_FUNCTION(rd_kafka_get_err_descs); -ZEND_FUNCTION(rd_kafka_err2name); -ZEND_FUNCTION(rd_kafka_err2str); -ZEND_FUNCTION(rd_kafka_errno2err); -ZEND_FUNCTION(rd_kafka_errno); -ZEND_FUNCTION(rd_kafka_offset_tail); -ZEND_FUNCTION(rd_kafka_thread_cnt); - - -static const zend_function_entry ext_functions[] = { - ZEND_FE(rd_kafka_get_err_descs, arginfo_rd_kafka_get_err_descs) - ZEND_FE(rd_kafka_err2name, arginfo_rd_kafka_err2name) - ZEND_FE(rd_kafka_err2str, arginfo_rd_kafka_err2str) - ZEND_DEP_FE(rd_kafka_errno2err, arginfo_rd_kafka_errno2err) - ZEND_DEP_FE(rd_kafka_errno, arginfo_rd_kafka_errno) - ZEND_FE(rd_kafka_offset_tail, arginfo_rd_kafka_offset_tail) - ZEND_FE(rd_kafka_thread_cnt, arginfo_rd_kafka_thread_cnt) - ZEND_FE_END -}; diff --git a/kafka_consumer.c b/kafka_consumer.c index d48abbd2..61638f33 100644 --- a/kafka_consumer.c +++ b/kafka_consumer.c @@ -31,11 +31,7 @@ #include "topic.h" #include "message.h" #include "metadata.h" -#if PHP_VERSION_ID < 80000 -#include "kafka_consumer_legacy_arginfo.h" -#else #include "kafka_consumer_arginfo.h" -#endif typedef struct _object_intern { rd_kafka_t *rk; @@ -581,7 +577,6 @@ PHP_METHOD(RdKafka_KafkaConsumer, getMetadata) } /* }}} */ -#ifdef HAS_RD_KAFKA_CONTROLLERID /* {{{ proto int RdKafka\KafkaConsumer::getControllerId(int $timeout_ms) Returns the current ControllerId (controller broker id) as reported in broker metadata */ PHP_METHOD(RdKafka_KafkaConsumer, getControllerId) @@ -601,7 +596,6 @@ PHP_METHOD(RdKafka_KafkaConsumer, getControllerId) RETURN_LONG(rd_kafka_controllerid(intern->rk, timeout)); } /* }}} */ -#endif /* {{{ proto RdKafka\KafkaConsumerTopic RdKafka\KafkaConsumer::newTopic(string $topic) Returns a RdKafka\KafkaConsumerTopic object */ diff --git a/kafka_consumer.stub.php b/kafka_consumer.stub.php index 8d21bbd6..9f4a3e68 100644 --- a/kafka_consumer.stub.php +++ b/kafka_consumer.stub.php @@ -56,10 +56,8 @@ public function unsubscribe(): void {} /** @tentative-return-type */ public function getMetadata(bool $all_topics, ?Topic $only_topic, int $timeout_ms): Metadata {} -#ifdef HAS_RD_KAFKA_CONTROLLERID /** @tentative-return-type */ public function getControllerId(int $timeout_ms): int {} -#endif /** @tentative-return-type */ public function newTopic(string $topic_name, ?TopicConf $topic_conf = null): KafkaConsumerTopic {} diff --git a/kafka_consumer_arginfo.h b/kafka_consumer_arginfo.h index bff6420c..a136e621 100644 --- a/kafka_consumer_arginfo.h +++ b/kafka_consumer_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 19d0e5f9de1e91016dd8e8c87e88c3d17e0c094f */ + * Stub hash: 5396249050f6bf118e5f830140cc016efee80def */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer___construct, 0, 0, 1) ZEND_ARG_OBJ_INFO(0, conf, RdKafka\\Conf, 0) @@ -81,7 +81,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getMetadata, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_END_ARG_INFO() -#if defined(HAS_RD_KAFKA_CONTROLLERID) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getControllerId, 0, 1, IS_LONG, 0) #else @@ -89,7 +88,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getControllerId, 0, 0 #endif ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_END_ARG_INFO() -#endif #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_newTopic, 0, 1, RdKafka\\KafkaConsumerTopic, 0) @@ -135,6 +133,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_KafkaConsumer_resumePartitions arginfo_class_RdKafka_KafkaConsumer_getOffsetPositions + ZEND_METHOD(RdKafka_KafkaConsumer, __construct); ZEND_METHOD(RdKafka_KafkaConsumer, assign); #if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) @@ -152,9 +151,7 @@ ZEND_METHOD(RdKafka_KafkaConsumer, subscribe); ZEND_METHOD(RdKafka_KafkaConsumer, getSubscription); ZEND_METHOD(RdKafka_KafkaConsumer, unsubscribe); ZEND_METHOD(RdKafka_KafkaConsumer, getMetadata); -#if defined(HAS_RD_KAFKA_CONTROLLERID) ZEND_METHOD(RdKafka_KafkaConsumer, getControllerId); -#endif ZEND_METHOD(RdKafka_KafkaConsumer, newTopic); ZEND_METHOD(RdKafka_KafkaConsumer, getCommittedOffsets); ZEND_METHOD(RdKafka_KafkaConsumer, getOffsetPositions); @@ -163,6 +160,7 @@ ZEND_METHOD(RdKafka_KafkaConsumer, offsetsForTimes); ZEND_METHOD(RdKafka_KafkaConsumer, pausePartitions); ZEND_METHOD(RdKafka_KafkaConsumer, resumePartitions); + static const zend_function_entry class_RdKafka_KafkaConsumer_methods[] = { ZEND_ME(RdKafka_KafkaConsumer, __construct, arginfo_class_RdKafka_KafkaConsumer___construct, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_KafkaConsumer, assign, arginfo_class_RdKafka_KafkaConsumer_assign, ZEND_ACC_PUBLIC) @@ -181,9 +179,7 @@ static const zend_function_entry class_RdKafka_KafkaConsumer_methods[] = { ZEND_ME(RdKafka_KafkaConsumer, getSubscription, arginfo_class_RdKafka_KafkaConsumer_getSubscription, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_KafkaConsumer, unsubscribe, arginfo_class_RdKafka_KafkaConsumer_unsubscribe, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_KafkaConsumer, getMetadata, arginfo_class_RdKafka_KafkaConsumer_getMetadata, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_CONTROLLERID) ZEND_ME(RdKafka_KafkaConsumer, getControllerId, arginfo_class_RdKafka_KafkaConsumer_getControllerId, ZEND_ACC_PUBLIC) -#endif ZEND_ME(RdKafka_KafkaConsumer, newTopic, arginfo_class_RdKafka_KafkaConsumer_newTopic, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_KafkaConsumer, getCommittedOffsets, arginfo_class_RdKafka_KafkaConsumer_getCommittedOffsets, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_KafkaConsumer, getOffsetPositions, arginfo_class_RdKafka_KafkaConsumer_getOffsetPositions, ZEND_ACC_PUBLIC) @@ -199,11 +195,7 @@ static zend_class_entry *register_class_RdKafka_KafkaConsumer(void) zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "RdKafka", "KafkaConsumer", class_RdKafka_KafkaConsumer_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); -#else class_entry = zend_register_internal_class_ex(&ce, NULL); -#endif zval property_error_cb_default_value; ZVAL_UNDEF(&property_error_cb_default_value); diff --git a/kafka_consumer_legacy_arginfo.h b/kafka_consumer_legacy_arginfo.h deleted file mode 100644 index 559fbfef..00000000 --- a/kafka_consumer_legacy_arginfo.h +++ /dev/null @@ -1,174 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 19d0e5f9de1e91016dd8e8c87e88c3d17e0c094f */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer___construct, 0, 0, 1) - ZEND_ARG_INFO(0, conf) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_assign, 0, 0, 0) - ZEND_ARG_INFO(0, topic_partitions) -ZEND_END_ARG_INFO() - -#if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_incrementalAssign, 0, 0, 1) - ZEND_ARG_INFO(0, topic_partitions) -ZEND_END_ARG_INFO() -#endif - -#if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) -#define arginfo_class_RdKafka_KafkaConsumer_incrementalUnassign arginfo_class_RdKafka_KafkaConsumer_incrementalAssign -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getAssignment, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_commit, 0, 0, 0) - ZEND_ARG_INFO(0, message_or_offsets) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_KafkaConsumer_close arginfo_class_RdKafka_KafkaConsumer_getAssignment - -#define arginfo_class_RdKafka_KafkaConsumer_commitAsync arginfo_class_RdKafka_KafkaConsumer_commit - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_consume, 0, 0, 1) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_subscribe, 0, 0, 1) - ZEND_ARG_INFO(0, topics) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_KafkaConsumer_getSubscription arginfo_class_RdKafka_KafkaConsumer_getAssignment - -#define arginfo_class_RdKafka_KafkaConsumer_unsubscribe arginfo_class_RdKafka_KafkaConsumer_getAssignment - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getMetadata, 0, 0, 3) - ZEND_ARG_INFO(0, all_topics) - ZEND_ARG_INFO(0, only_topic) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -#if defined(HAS_RD_KAFKA_CONTROLLERID) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getControllerId, 0, 0, 1) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_newTopic, 0, 0, 1) - ZEND_ARG_INFO(0, topic_name) - ZEND_ARG_INFO(0, topic_conf) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getCommittedOffsets, 0, 0, 2) - ZEND_ARG_INFO(0, topic_partitions) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getOffsetPositions, 0, 0, 1) - ZEND_ARG_INFO(0, topic_partitions) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_queryWatermarkOffsets, 0, 0, 5) - ZEND_ARG_INFO(0, topic) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(1, low) - ZEND_ARG_INFO(1, high) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_KafkaConsumer_offsetsForTimes arginfo_class_RdKafka_KafkaConsumer_getCommittedOffsets - -#define arginfo_class_RdKafka_KafkaConsumer_pausePartitions arginfo_class_RdKafka_KafkaConsumer_getOffsetPositions - -#define arginfo_class_RdKafka_KafkaConsumer_resumePartitions arginfo_class_RdKafka_KafkaConsumer_getOffsetPositions - -ZEND_METHOD(RdKafka_KafkaConsumer, __construct); -ZEND_METHOD(RdKafka_KafkaConsumer, assign); -#if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) -ZEND_METHOD(RdKafka_KafkaConsumer, incrementalAssign); -#endif -#if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) -ZEND_METHOD(RdKafka_KafkaConsumer, incrementalUnassign); -#endif -ZEND_METHOD(RdKafka_KafkaConsumer, getAssignment); -ZEND_METHOD(RdKafka_KafkaConsumer, commit); -ZEND_METHOD(RdKafka_KafkaConsumer, close); -ZEND_METHOD(RdKafka_KafkaConsumer, commitAsync); -ZEND_METHOD(RdKafka_KafkaConsumer, consume); -ZEND_METHOD(RdKafka_KafkaConsumer, subscribe); -ZEND_METHOD(RdKafka_KafkaConsumer, getSubscription); -ZEND_METHOD(RdKafka_KafkaConsumer, unsubscribe); -ZEND_METHOD(RdKafka_KafkaConsumer, getMetadata); -#if defined(HAS_RD_KAFKA_CONTROLLERID) -ZEND_METHOD(RdKafka_KafkaConsumer, getControllerId); -#endif -ZEND_METHOD(RdKafka_KafkaConsumer, newTopic); -ZEND_METHOD(RdKafka_KafkaConsumer, getCommittedOffsets); -ZEND_METHOD(RdKafka_KafkaConsumer, getOffsetPositions); -ZEND_METHOD(RdKafka_KafkaConsumer, queryWatermarkOffsets); -ZEND_METHOD(RdKafka_KafkaConsumer, offsetsForTimes); -ZEND_METHOD(RdKafka_KafkaConsumer, pausePartitions); -ZEND_METHOD(RdKafka_KafkaConsumer, resumePartitions); - -static const zend_function_entry class_RdKafka_KafkaConsumer_methods[] = { - ZEND_ME(RdKafka_KafkaConsumer, __construct, arginfo_class_RdKafka_KafkaConsumer___construct, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, assign, arginfo_class_RdKafka_KafkaConsumer_assign, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) - ZEND_ME(RdKafka_KafkaConsumer, incrementalAssign, arginfo_class_RdKafka_KafkaConsumer_incrementalAssign, ZEND_ACC_PUBLIC) -#endif -#if defined(HAS_RD_KAFKA_INCREMENTAL_ASSIGN) - ZEND_ME(RdKafka_KafkaConsumer, incrementalUnassign, arginfo_class_RdKafka_KafkaConsumer_incrementalUnassign, ZEND_ACC_PUBLIC) -#endif - ZEND_ME(RdKafka_KafkaConsumer, getAssignment, arginfo_class_RdKafka_KafkaConsumer_getAssignment, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, commit, arginfo_class_RdKafka_KafkaConsumer_commit, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, close, arginfo_class_RdKafka_KafkaConsumer_close, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, commitAsync, arginfo_class_RdKafka_KafkaConsumer_commitAsync, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, consume, arginfo_class_RdKafka_KafkaConsumer_consume, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, subscribe, arginfo_class_RdKafka_KafkaConsumer_subscribe, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, getSubscription, arginfo_class_RdKafka_KafkaConsumer_getSubscription, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, unsubscribe, arginfo_class_RdKafka_KafkaConsumer_unsubscribe, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, getMetadata, arginfo_class_RdKafka_KafkaConsumer_getMetadata, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_CONTROLLERID) - ZEND_ME(RdKafka_KafkaConsumer, getControllerId, arginfo_class_RdKafka_KafkaConsumer_getControllerId, ZEND_ACC_PUBLIC) -#endif - ZEND_ME(RdKafka_KafkaConsumer, newTopic, arginfo_class_RdKafka_KafkaConsumer_newTopic, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, getCommittedOffsets, arginfo_class_RdKafka_KafkaConsumer_getCommittedOffsets, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, getOffsetPositions, arginfo_class_RdKafka_KafkaConsumer_getOffsetPositions, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, queryWatermarkOffsets, arginfo_class_RdKafka_KafkaConsumer_queryWatermarkOffsets, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, offsetsForTimes, arginfo_class_RdKafka_KafkaConsumer_offsetsForTimes, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, pausePartitions, arginfo_class_RdKafka_KafkaConsumer_pausePartitions, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaConsumer, resumePartitions, arginfo_class_RdKafka_KafkaConsumer_resumePartitions, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_KafkaConsumer(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "KafkaConsumer", class_RdKafka_KafkaConsumer_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, 0); -#else - class_entry = zend_register_internal_class_ex(&ce, NULL); -#endif - - zval property_error_cb_default_value; - ZVAL_NULL(&property_error_cb_default_value); - zend_string *property_error_cb_name = zend_string_init("error_cb", sizeof("error_cb") - 1, 1); - zend_declare_property_ex(class_entry, property_error_cb_name, &property_error_cb_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_error_cb_name); - - zval property_rebalance_cb_default_value; - ZVAL_NULL(&property_rebalance_cb_default_value); - zend_string *property_rebalance_cb_name = zend_string_init("rebalance_cb", sizeof("rebalance_cb") - 1, 1); - zend_declare_property_ex(class_entry, property_rebalance_cb_name, &property_rebalance_cb_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_rebalance_cb_name); - - zval property_dr_msg_cb_default_value; - ZVAL_NULL(&property_dr_msg_cb_default_value); - zend_string *property_dr_msg_cb_name = zend_string_init("dr_msg_cb", sizeof("dr_msg_cb") - 1, 1); - zend_declare_property_ex(class_entry, property_dr_msg_cb_name, &property_dr_msg_cb_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_dr_msg_cb_name); - - return class_entry; -} diff --git a/kafka_error_exception.c b/kafka_error_exception.c index 8c19ca0c..f740a0d8 100644 --- a/kafka_error_exception.c +++ b/kafka_error_exception.c @@ -21,17 +21,12 @@ #endif #include "php.h" -#ifdef HAS_RD_KAFKA_TRANSACTIONS #include "php_rdkafka.h" #include "php_rdkafka_priv.h" #include "Zend/zend_interfaces.h" #include "Zend/zend_exceptions.h" #include "kafka_error_exception.h" -#if PHP_VERSION_ID < 80000 -#include "kafka_error_exception_legacy_arginfo.h" -#else #include "kafka_error_exception_arginfo.h" -#endif zend_class_entry * ce_kafka_error; @@ -163,5 +158,3 @@ void kafka_error_minit() /* {{{ */ { ce_kafka_error = register_class_RdKafka_KafkaErrorException(ce_kafka_exception); } /* }}} */ -#endif - diff --git a/kafka_error_exception.h b/kafka_error_exception.h index d44b8954..2919b420 100644 --- a/kafka_error_exception.h +++ b/kafka_error_exception.h @@ -16,12 +16,9 @@ +----------------------------------------------------------------------+ */ -#ifdef HAS_RD_KAFKA_TRANSACTIONS - #include "librdkafka/rdkafka.h" #include "Zend/zend_interfaces.h" extern zend_class_entry * ce_kafka_error; void kafka_error_minit(); void create_kafka_error(zval *return_value, const rd_kafka_error_t *error); -#endif diff --git a/kafka_error_exception_legacy_arginfo.h b/kafka_error_exception_legacy_arginfo.h deleted file mode 100644 index b49b1139..00000000 --- a/kafka_error_exception_legacy_arginfo.h +++ /dev/null @@ -1,71 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1a50cd552973f23b01a2d6b4e5464ba14320c393 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaErrorException___construct, 0, 0, 6) - ZEND_ARG_INFO(0, message) - ZEND_ARG_INFO(0, code) - ZEND_ARG_INFO(0, error_string) - ZEND_ARG_INFO(0, isFatal) - ZEND_ARG_INFO(0, isRetriable) - ZEND_ARG_INFO(0, transactionRequiresAbort) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaErrorException_getErrorString, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_KafkaErrorException_isFatal arginfo_class_RdKafka_KafkaErrorException_getErrorString - -#define arginfo_class_RdKafka_KafkaErrorException_isRetriable arginfo_class_RdKafka_KafkaErrorException_getErrorString - -#define arginfo_class_RdKafka_KafkaErrorException_transactionRequiresAbort arginfo_class_RdKafka_KafkaErrorException_getErrorString - - -ZEND_METHOD(RdKafka_KafkaErrorException, __construct); -ZEND_METHOD(RdKafka_KafkaErrorException, getErrorString); -ZEND_METHOD(RdKafka_KafkaErrorException, isFatal); -ZEND_METHOD(RdKafka_KafkaErrorException, isRetriable); -ZEND_METHOD(RdKafka_KafkaErrorException, transactionRequiresAbort); - - -static const zend_function_entry class_RdKafka_KafkaErrorException_methods[] = { - ZEND_ME(RdKafka_KafkaErrorException, __construct, arginfo_class_RdKafka_KafkaErrorException___construct, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaErrorException, getErrorString, arginfo_class_RdKafka_KafkaErrorException_getErrorString, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaErrorException, isFatal, arginfo_class_RdKafka_KafkaErrorException_isFatal, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaErrorException, isRetriable, arginfo_class_RdKafka_KafkaErrorException_isRetriable, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_KafkaErrorException, transactionRequiresAbort, arginfo_class_RdKafka_KafkaErrorException_transactionRequiresAbort, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_KafkaErrorException(zend_class_entry *class_entry_RdKafka_Exception) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "KafkaErrorException", class_RdKafka_KafkaErrorException_methods); - class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka_Exception); - - zval property_error_string_default_value; - ZVAL_NULL(&property_error_string_default_value); - zend_string *property_error_string_name = zend_string_init("error_string", sizeof("error_string") - 1, 1); - zend_declare_property_ex(class_entry, property_error_string_name, &property_error_string_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_error_string_name); - - zval property_isFatal_default_value; - ZVAL_NULL(&property_isFatal_default_value); - zend_string *property_isFatal_name = zend_string_init("isFatal", sizeof("isFatal") - 1, 1); - zend_declare_property_ex(class_entry, property_isFatal_name, &property_isFatal_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_isFatal_name); - - zval property_isRetriable_default_value; - ZVAL_NULL(&property_isRetriable_default_value); - zend_string *property_isRetriable_name = zend_string_init("isRetriable", sizeof("isRetriable") - 1, 1); - zend_declare_property_ex(class_entry, property_isRetriable_name, &property_isRetriable_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_isRetriable_name); - - zval property_transactionRequiresAbort_default_value; - ZVAL_NULL(&property_transactionRequiresAbort_default_value); - zend_string *property_transactionRequiresAbort_name = zend_string_init("transactionRequiresAbort", sizeof("transactionRequiresAbort") - 1, 1); - zend_declare_property_ex(class_entry, property_transactionRequiresAbort_name, &property_transactionRequiresAbort_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_transactionRequiresAbort_name); - - return class_entry; -} diff --git a/message.c b/message.c index ba794382..b9278ae5 100644 --- a/message.c +++ b/message.c @@ -29,11 +29,7 @@ #include "Zend/zend_exceptions.h" #include "topic.h" #include "message.h" -#if PHP_VERSION_ID < 80000 -#include "message_legacy_arginfo.h" -#else #include "message_arginfo.h" -#endif zend_class_entry * ce_kafka_message; @@ -47,14 +43,12 @@ void kafka_message_new(zval *return_value, const rd_kafka_message_t *message, ze timestamp = rd_kafka_message_timestamp(message, &tstype); zval headers_array; -#ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS rd_kafka_headers_t *message_headers = NULL; rd_kafka_resp_err_t header_response; const char *header_name = NULL; const void *header_value = NULL; size_t header_size = 0; size_t i; -#endif /* HAVE_RD_KAFKA_MESSAGE_HEADERS */ zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("err"), message->err); @@ -73,7 +67,6 @@ void kafka_message_new(zval *return_value, const rd_kafka_message_t *message, ze zend_update_property_long(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("offset"), message->offset); array_init(&headers_array); -#ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS if (message->err == RD_KAFKA_RESP_ERR_NO_ERROR) { rd_kafka_message_headers(message, &message_headers); if (message_headers != NULL) { @@ -86,7 +79,6 @@ void kafka_message_new(zval *return_value, const rd_kafka_message_t *message, ze } } } -#endif zend_update_property(NULL, Z_RDKAFKA_PROP_OBJ(return_value), ZEND_STRL("headers"), &headers_array); zval_ptr_dtor(&headers_array); diff --git a/message_legacy_arginfo.h b/message_legacy_arginfo.h deleted file mode 100644 index 2cf9ec7b..00000000 --- a/message_legacy_arginfo.h +++ /dev/null @@ -1,84 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: f642f90b8a3c35c353320c0574902898a3645ee1 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Message_errstr, 0, 0, 0) -ZEND_END_ARG_INFO() - - -ZEND_METHOD(RdKafka_Message, errstr); - - -static const zend_function_entry class_RdKafka_Message_methods[] = { - ZEND_ME(RdKafka_Message, errstr, arginfo_class_RdKafka_Message_errstr, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Message(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Message", class_RdKafka_Message_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - zval property_err_default_value; - ZVAL_NULL(&property_err_default_value); - zend_string *property_err_name = zend_string_init("err", sizeof("err") - 1, 1); - zend_declare_property_ex(class_entry, property_err_name, &property_err_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_err_name); - - zval property_topic_name_default_value; - ZVAL_NULL(&property_topic_name_default_value); - zend_string *property_topic_name_name = zend_string_init("topic_name", sizeof("topic_name") - 1, 1); - zend_declare_property_ex(class_entry, property_topic_name_name, &property_topic_name_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_topic_name_name); - - zval property_timestamp_default_value; - ZVAL_NULL(&property_timestamp_default_value); - zend_string *property_timestamp_name = zend_string_init("timestamp", sizeof("timestamp") - 1, 1); - zend_declare_property_ex(class_entry, property_timestamp_name, &property_timestamp_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_timestamp_name); - - zval property_partition_default_value; - ZVAL_NULL(&property_partition_default_value); - zend_string *property_partition_name = zend_string_init("partition", sizeof("partition") - 1, 1); - zend_declare_property_ex(class_entry, property_partition_name, &property_partition_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_partition_name); - - zval property_payload_default_value; - ZVAL_NULL(&property_payload_default_value); - zend_string *property_payload_name = zend_string_init("payload", sizeof("payload") - 1, 1); - zend_declare_property_ex(class_entry, property_payload_name, &property_payload_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_payload_name); - - zval property_len_default_value; - ZVAL_NULL(&property_len_default_value); - zend_string *property_len_name = zend_string_init("len", sizeof("len") - 1, 1); - zend_declare_property_ex(class_entry, property_len_name, &property_len_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_len_name); - - zval property_key_default_value; - ZVAL_NULL(&property_key_default_value); - zend_string *property_key_name = zend_string_init("key", sizeof("key") - 1, 1); - zend_declare_property_ex(class_entry, property_key_name, &property_key_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_key_name); - - zval property_offset_default_value; - ZVAL_NULL(&property_offset_default_value); - zend_string *property_offset_name = zend_string_init("offset", sizeof("offset") - 1, 1); - zend_declare_property_ex(class_entry, property_offset_name, &property_offset_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_offset_name); - - zval property_headers_default_value; - ZVAL_NULL(&property_headers_default_value); - zend_string *property_headers_name = zend_string_init("headers", sizeof("headers") - 1, 1); - zend_declare_property_ex(class_entry, property_headers_name, &property_headers_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_headers_name); - - zval property_opaque_default_value; - ZVAL_NULL(&property_opaque_default_value); - zend_string *property_opaque_name = zend_string_init("opaque", sizeof("opaque") - 1, 1); - zend_declare_property_ex(class_entry, property_opaque_name, &property_opaque_default_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(property_opaque_name); - - return class_entry; -} diff --git a/metadata.c b/metadata.c index 4e382480..62c42522 100644 --- a/metadata.c +++ b/metadata.c @@ -29,11 +29,7 @@ #include "metadata_broker.h" #include "metadata_partition.h" #include "Zend/zend_exceptions.h" -#if PHP_VERSION_ID < 80000 -#include "metadata_legacy_arginfo.h" -#else #include "metadata_arginfo.h" -#endif typedef struct _object_intern { const rd_kafka_metadata_t *metadata; diff --git a/metadata_broker.c b/metadata_broker.c index 0edb0281..93c2def8 100644 --- a/metadata_broker.c +++ b/metadata_broker.c @@ -27,11 +27,7 @@ #include "ext/spl/spl_iterators.h" #include "Zend/zend_interfaces.h" #include "Zend/zend_exceptions.h" -#if PHP_VERSION_ID < 80000 -#include "metadata_broker_legacy_arginfo.h" -#else #include "metadata_broker_arginfo.h" -#endif typedef struct _object_intern { zval zmetadata; diff --git a/metadata_broker_legacy_arginfo.h b/metadata_broker_legacy_arginfo.h deleted file mode 100644 index cd63fc09..00000000 --- a/metadata_broker_legacy_arginfo.h +++ /dev/null @@ -1,37 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 74c6ee55c31bb86f5bcf71a46607f31688ce71dd */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Broker___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Broker_getId, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Metadata_Broker_getHost arginfo_class_RdKafka_Metadata_Broker_getId - -#define arginfo_class_RdKafka_Metadata_Broker_getPort arginfo_class_RdKafka_Metadata_Broker_getId - - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_Metadata_Broker, getId); -ZEND_METHOD(RdKafka_Metadata_Broker, getHost); -ZEND_METHOD(RdKafka_Metadata_Broker, getPort); - - -static const zend_function_entry class_RdKafka_Metadata_Broker_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_Metadata_Broker___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_Metadata_Broker, getId, arginfo_class_RdKafka_Metadata_Broker_getId, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Broker, getHost, arginfo_class_RdKafka_Metadata_Broker_getHost, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Broker, getPort, arginfo_class_RdKafka_Metadata_Broker_getPort, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Metadata_Broker(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka\\Metadata", "Broker", class_RdKafka_Metadata_Broker_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - return class_entry; -} diff --git a/metadata_collection.c b/metadata_collection.c index 79be380f..67be479d 100644 --- a/metadata_collection.c +++ b/metadata_collection.c @@ -28,11 +28,7 @@ #include "Zend/zend_interfaces.h" #include "metadata_collection.h" #include "Zend/zend_exceptions.h" -#if PHP_VERSION_ID < 80000 -#include "metadata_collection_legacy_arginfo.h" -#else #include "metadata_collection_arginfo.h" -#endif typedef struct _object_intern { zval zmetadata; @@ -241,11 +237,7 @@ PHP_METHOD(RdKafka_Metadata_Collection, valid) void kafka_metadata_collection_minit(INIT_FUNC_ARGS) { -#if PHP_VERSION_ID < 80100 - ce = register_class_RdKafka_Metadata_Collection(spl_ce_Countable, spl_ce_Iterator); -#else ce = register_class_RdKafka_Metadata_Collection(zend_ce_countable, zend_ce_iterator); -#endif ce->create_object = create_object; handlers = kafka_default_object_handlers; diff --git a/metadata_collection_legacy_arginfo.h b/metadata_collection_legacy_arginfo.h deleted file mode 100644 index 16f47592..00000000 --- a/metadata_collection_legacy_arginfo.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 43c071a00a4c0beb6b5c1f8f685e29b746c2d3fb */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Collection___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Collection_count, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Metadata_Collection_current arginfo_class_RdKafka_Metadata_Collection_count - -#define arginfo_class_RdKafka_Metadata_Collection_key arginfo_class_RdKafka_Metadata_Collection_count - -#define arginfo_class_RdKafka_Metadata_Collection_next arginfo_class_RdKafka_Metadata_Collection_count - -#define arginfo_class_RdKafka_Metadata_Collection_rewind arginfo_class_RdKafka_Metadata_Collection_count - -#define arginfo_class_RdKafka_Metadata_Collection_valid arginfo_class_RdKafka_Metadata_Collection_count - - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_Metadata_Collection, count); -ZEND_METHOD(RdKafka_Metadata_Collection, current); -ZEND_METHOD(RdKafka_Metadata_Collection, key); -ZEND_METHOD(RdKafka_Metadata_Collection, next); -ZEND_METHOD(RdKafka_Metadata_Collection, rewind); -ZEND_METHOD(RdKafka_Metadata_Collection, valid); - - -static const zend_function_entry class_RdKafka_Metadata_Collection_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_Metadata_Collection___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_Metadata_Collection, count, arginfo_class_RdKafka_Metadata_Collection_count, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Collection, current, arginfo_class_RdKafka_Metadata_Collection_current, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Collection, key, arginfo_class_RdKafka_Metadata_Collection_key, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Collection, next, arginfo_class_RdKafka_Metadata_Collection_next, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Collection, rewind, arginfo_class_RdKafka_Metadata_Collection_rewind, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Collection, valid, arginfo_class_RdKafka_Metadata_Collection_valid, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Metadata_Collection(zend_class_entry *class_entry_Countable, zend_class_entry *class_entry_Iterator) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka\\Metadata", "Collection", class_RdKafka_Metadata_Collection_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - zend_class_implements(class_entry, 2, class_entry_Countable, class_entry_Iterator); - - return class_entry; -} diff --git a/metadata_legacy_arginfo.h b/metadata_legacy_arginfo.h deleted file mode 100644 index 8d190dc0..00000000 --- a/metadata_legacy_arginfo.h +++ /dev/null @@ -1,41 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6c980079f802be29ef2c30e235a6071f5c0d628c */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_getOrigBrokerId, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Metadata_getOrigBrokerName arginfo_class_RdKafka_Metadata_getOrigBrokerId - -#define arginfo_class_RdKafka_Metadata_getBrokers arginfo_class_RdKafka_Metadata_getOrigBrokerId - -#define arginfo_class_RdKafka_Metadata_getTopics arginfo_class_RdKafka_Metadata_getOrigBrokerId - - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_Metadata, getOrigBrokerId); -ZEND_METHOD(RdKafka_Metadata, getOrigBrokerName); -ZEND_METHOD(RdKafka_Metadata, getBrokers); -ZEND_METHOD(RdKafka_Metadata, getTopics); - - -static const zend_function_entry class_RdKafka_Metadata_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_Metadata___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_Metadata, getOrigBrokerId, arginfo_class_RdKafka_Metadata_getOrigBrokerId, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata, getOrigBrokerName, arginfo_class_RdKafka_Metadata_getOrigBrokerName, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata, getBrokers, arginfo_class_RdKafka_Metadata_getBrokers, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata, getTopics, arginfo_class_RdKafka_Metadata_getTopics, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Metadata(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Metadata", class_RdKafka_Metadata_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - return class_entry; -} diff --git a/metadata_partition.c b/metadata_partition.c index c8a6c7db..9a66217c 100644 --- a/metadata_partition.c +++ b/metadata_partition.c @@ -28,11 +28,7 @@ #include "Zend/zend_interfaces.h" #include "Zend/zend_exceptions.h" #include "metadata_collection.h" -#if PHP_VERSION_ID < 80000 -#include "metadata_partition_legacy_arginfo.h" -#else #include "metadata_partition_arginfo.h" -#endif typedef struct _object_intern { zval zmetadata; diff --git a/metadata_partition_legacy_arginfo.h b/metadata_partition_legacy_arginfo.h deleted file mode 100644 index 13c2e716..00000000 --- a/metadata_partition_legacy_arginfo.h +++ /dev/null @@ -1,45 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: ce824cf273ec8fec1fe3b6eaac015a51f3e9dc6b */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Partition___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Partition_getId, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Metadata_Partition_getErr arginfo_class_RdKafka_Metadata_Partition_getId - -#define arginfo_class_RdKafka_Metadata_Partition_getLeader arginfo_class_RdKafka_Metadata_Partition_getId - -#define arginfo_class_RdKafka_Metadata_Partition_getReplicas arginfo_class_RdKafka_Metadata_Partition_getId - -#define arginfo_class_RdKafka_Metadata_Partition_getIsrs arginfo_class_RdKafka_Metadata_Partition_getId - - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_Metadata_Partition, getId); -ZEND_METHOD(RdKafka_Metadata_Partition, getErr); -ZEND_METHOD(RdKafka_Metadata_Partition, getLeader); -ZEND_METHOD(RdKafka_Metadata_Partition, getReplicas); -ZEND_METHOD(RdKafka_Metadata_Partition, getIsrs); - - -static const zend_function_entry class_RdKafka_Metadata_Partition_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_Metadata_Partition___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_Metadata_Partition, getId, arginfo_class_RdKafka_Metadata_Partition_getId, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Partition, getErr, arginfo_class_RdKafka_Metadata_Partition_getErr, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Partition, getLeader, arginfo_class_RdKafka_Metadata_Partition_getLeader, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Partition, getReplicas, arginfo_class_RdKafka_Metadata_Partition_getReplicas, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Partition, getIsrs, arginfo_class_RdKafka_Metadata_Partition_getIsrs, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Metadata_Partition(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka\\Metadata", "Partition", class_RdKafka_Metadata_Partition_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - return class_entry; -} diff --git a/metadata_topic.c b/metadata_topic.c index d2f9fff9..acd7fd22 100644 --- a/metadata_topic.c +++ b/metadata_topic.c @@ -29,11 +29,7 @@ #include "metadata_partition.h" #include "metadata_collection.h" #include "Zend/zend_exceptions.h" -#if PHP_VERSION_ID < 80000 -#include "metadata_topic_legacy_arginfo.h" -#else #include "metadata_topic_arginfo.h" -#endif typedef struct _object_intern { zval zmetadata; diff --git a/metadata_topic_legacy_arginfo.h b/metadata_topic_legacy_arginfo.h deleted file mode 100644 index 8224ac4f..00000000 --- a/metadata_topic_legacy_arginfo.h +++ /dev/null @@ -1,37 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 04fd71ae954bd0a09730d401c8160574e1045369 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Topic___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Metadata_Topic_getTopic, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Metadata_Topic_getErr arginfo_class_RdKafka_Metadata_Topic_getTopic - -#define arginfo_class_RdKafka_Metadata_Topic_getPartitions arginfo_class_RdKafka_Metadata_Topic_getTopic - - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_Metadata_Topic, getTopic); -ZEND_METHOD(RdKafka_Metadata_Topic, getErr); -ZEND_METHOD(RdKafka_Metadata_Topic, getPartitions); - - -static const zend_function_entry class_RdKafka_Metadata_Topic_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_Metadata_Topic___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_Metadata_Topic, getTopic, arginfo_class_RdKafka_Metadata_Topic_getTopic, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Topic, getErr, arginfo_class_RdKafka_Metadata_Topic_getErr, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Metadata_Topic, getPartitions, arginfo_class_RdKafka_Metadata_Topic_getPartitions, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Metadata_Topic(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka\\Metadata", "Topic", class_RdKafka_Metadata_Topic_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - return class_entry; -} diff --git a/package.xml b/package.xml index 3634035a..38aadf4b 100644 --- a/package.xml +++ b/package.xml @@ -42,28 +42,23 @@ - - - - - @@ -72,44 +67,35 @@ - - - - - - - - - @@ -145,7 +131,6 @@ - @@ -164,7 +149,7 @@ - 7.0.0 + 8.1.0 8.99.99 diff --git a/queue.c b/queue.c index 07f73283..e9b21e4d 100644 --- a/queue.c +++ b/queue.c @@ -30,11 +30,7 @@ #include "topic.h" #include "queue.h" #include "message.h" -#if PHP_VERSION_ID < 80000 -#include "queue_legacy_arginfo.h" -#else #include "queue_arginfo.h" -#endif zend_class_entry * ce_kafka_queue; diff --git a/queue_legacy_arginfo.h b/queue_legacy_arginfo.h deleted file mode 100644 index eaf2c921..00000000 --- a/queue_legacy_arginfo.h +++ /dev/null @@ -1,30 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9e80d48bb60ede4003fffcfe0da09ac0e5c2f4d1 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Queue___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Queue_consume, 0, 0, 1) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_Queue, consume); - - -static const zend_function_entry class_RdKafka_Queue_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_Queue___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_Queue, consume, arginfo_class_RdKafka_Queue_consume, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Queue(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Queue", class_RdKafka_Queue_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - return class_entry; -} diff --git a/rdkafka.c b/rdkafka.c index 4029409a..9576d61d 100644 --- a/rdkafka.c +++ b/rdkafka.c @@ -22,10 +22,6 @@ #include "config.h" #endif -#ifdef HAS_RD_KAFKA_TRANSACTIONS -#include "kafka_error_exception.h" -#endif - #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" @@ -41,16 +37,16 @@ #include "message.h" #include "kafka_consumer.h" #include "topic_partition.h" -#if PHP_VERSION_ID < 80000 -#include "rdkafka_legacy_arginfo.h" -#include "fun_legacy_arginfo.h" -#else #include "rdkafka_arginfo.h" #include "fun_arginfo.h" +#include "kafka_error_exception.h" + +#if PHP_VERSION_ID < 80100 +# error "PHP version 8.1.0 or greater required" #endif -#if RD_KAFKA_VERSION < 0x000b0000 -# error librdkafka version 0.11.0 or greater required +#if RD_KAFKA_VERSION < 0x010503ff +# error librdkafka version 1.5.3 or greater required #endif enum { @@ -92,12 +88,10 @@ static void kafka_free(zend_object *object) /* {{{ */ zend_hash_destroy(&intern->consuming); zend_hash_destroy(&intern->queues); } else if (intern->type == RD_KAFKA_PRODUCER) { -#ifdef HAS_RD_KAFKA_PURGE // Force internal delivery callbacks for queued messages, as we rely // on these to free msg_opaques rd_kafka_purge(intern->rk, RD_KAFKA_PURGE_F_QUEUE | RD_KAFKA_PURGE_F_INFLIGHT); rd_kafka_flush(intern->rk, 0); -#endif } zend_hash_destroy(&intern->topics); @@ -389,7 +383,6 @@ PHP_METHOD(RdKafka, getMetadata) } /* }}} */ -#ifdef HAS_RD_KAFKA_CONTROLLERID /* {{{ proto int RdKafka::getControllerId(int $timeout_ms) Returns the current ControllerId (controller broker id) as reported in broker metadata */ PHP_METHOD(RdKafka, getControllerId) @@ -409,7 +402,6 @@ PHP_METHOD(RdKafka, getControllerId) RETURN_LONG(rd_kafka_controllerid(intern->rk, timeout)); } /* }}} */ -#endif /* {{{ proto void RdKafka::setLogLevel(int $level) Specifies the maximum logging level produced by internal kafka logging and debugging */ @@ -431,7 +423,6 @@ PHP_METHOD(RdKafka, setLogLevel) } /* }}} */ -#ifdef HAS_RD_KAFKA_OAUTHBEARER /* {{{ proto void RdKafka::oauthbearerSetToken(string $token_value, int $lifetime_ms, string $principal_name, array $extensions = []) * Set SASL/OAUTHBEARER token and metadata * @@ -568,7 +559,6 @@ PHP_METHOD(RdKafka, oauthbearerSetTokenFailure) } } /* }}} */ -#endif /* {{{ proto RdKafka\Topic RdKafka::newTopic(string $topic) Returns an RdKafka\Topic object */ @@ -694,7 +684,6 @@ PHP_METHOD(RdKafka, flush) } /* }}} */ -#ifdef HAS_RD_KAFKA_PURGE /* {{{ proto int RdKafka::purge(int $purge_flags) Purge messages that are in queue or in flight */ PHP_METHOD(RdKafka, purge) @@ -714,7 +703,6 @@ PHP_METHOD(RdKafka, purge) RETURN_LONG(rd_kafka_purge(intern->rk, purge_flags)); } /* }}} */ -#endif /* {{{ proto void RdKafka::queryWatermarkOffsets(string $topic, int $partition, int &$low, int &$high, int $timeout_ms) Query broker for low (oldest/beginning) or high (newest/end) offsets for partition */ @@ -917,7 +905,6 @@ PHP_METHOD(RdKafka_Producer, __construct) } /* }}} */ -#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 */ PHP_METHOD(RdKafka_Producer, initTransactions) @@ -1024,7 +1011,6 @@ PHP_METHOD(RdKafka_Producer, abortTransaction) zend_throw_exception_object(return_value); } /* }}} */ -#endif #define COPY_CONSTANT(name) \ REGISTER_LONG_CONSTANT(#name, name, CONST_CS | CONST_PERSISTENT) @@ -1066,11 +1052,9 @@ PHP_MINIT_FUNCTION(rdkafka) COPY_CONSTANT(RD_KAFKA_PARTITION_UA); COPY_CONSTANT(RD_KAFKA_PRODUCER); COPY_CONSTANT(RD_KAFKA_MSG_F_BLOCK); -#ifdef HAS_RD_KAFKA_PURGE COPY_CONSTANT(RD_KAFKA_PURGE_F_QUEUE); COPY_CONSTANT(RD_KAFKA_PURGE_F_INFLIGHT); COPY_CONSTANT(RD_KAFKA_PURGE_F_NON_BLOCKING); -#endif REGISTER_LONG_CONSTANT("RD_KAFKA_VERSION", rd_kafka_version(), CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("RD_KAFKA_BUILD_VERSION", RD_KAFKA_VERSION, CONST_CS | CONST_PERSISTENT); @@ -1083,10 +1067,8 @@ PHP_MINIT_FUNCTION(rdkafka) REGISTER_LONG_CONSTANT("RD_KAFKA_MSG_PARTITIONER_RANDOM", MSG_PARTITIONER_RANDOM, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("RD_KAFKA_MSG_PARTITIONER_CONSISTENT", MSG_PARTITIONER_CONSISTENT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("RD_KAFKA_MSG_PARTITIONER_CONSISTENT_RANDOM", MSG_PARTITIONER_CONSISTENT_RANDOM, CONST_CS | CONST_PERSISTENT); -#ifdef HAS_RD_KAFKA_PARTITIONER_MURMUR2 REGISTER_LONG_CONSTANT("RD_KAFKA_MSG_PARTITIONER_MURMUR2", MSG_PARTITIONER_MURMUR2, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("RD_KAFKA_MSG_PARTITIONER_MURMUR2_RANDOM", MSG_PARTITIONER_MURMUR2_RANDOM, CONST_CS | CONST_PERSISTENT); -#endif REGISTER_LONG_CONSTANT("RD_KAFKA_LOG_PRINT", RD_KAFKA_LOG_PRINT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("RD_KAFKA_LOG_SYSLOG", RD_KAFKA_LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); @@ -1109,9 +1091,7 @@ PHP_MINIT_FUNCTION(rdkafka) ce_kafka_exception = register_class_RdKafka_Exception(zend_ce_exception); kafka_conf_minit(INIT_FUNC_ARGS_PASSTHRU); -#ifdef HAS_RD_KAFKA_TRANSACTIONS kafka_error_minit(); -#endif kafka_kafka_consumer_minit(INIT_FUNC_ARGS_PASSTHRU); kafka_message_minit(INIT_FUNC_ARGS_PASSTHRU); kafka_metadata_minit(INIT_FUNC_ARGS_PASSTHRU); diff --git a/rdkafka.stub.php b/rdkafka.stub.php index 3d99ef22..63a5dd97 100644 --- a/rdkafka.stub.php +++ b/rdkafka.stub.php @@ -20,10 +20,8 @@ public function addBrokers(string $broker_list): int {} /** @tentative-return-type */ public function getMetadata(bool $all_topics, ?RdKafka\Topic $only_topic, int $timeout_ms): RdKafka\Metadata {} -#ifdef HAS_RD_KAFKA_CONTROLLERID /** @tentative-return-type */ public function getControllerId(int $timeout_ms): int {} -#endif /** @tentative-return-type */ public function getOutQLen(): int {} @@ -57,10 +55,8 @@ public function poll(int $timeout_ms): int {} /** @tentative-return-type */ public function flush(int $timeout_ms): int {} -#ifdef HAS_RD_KAFKA_PURGE /** @tentative-return-type */ public function purge(int $purge_flags): int {} -#endif /** * @deprecated @@ -80,13 +76,11 @@ public function pausePartitions(array $topic_partitions): array {} /** @tentative-return-type */ public function resumePartitions(array $topic_partitions): array {} - #ifdef HAS_RD_KAFKA_OAUTHBEARER /** @tentative-return-type */ public function oauthbearerSetToken(string $token_value, int $lifetime_ms, string $principal_name, array $extensions = []): void {} /** @tentative-return-type */ public function oauthbearerSetTokenFailure(string $error): void {} - #endif } } @@ -104,7 +98,6 @@ public function newQueue(): Queue {} class Producer extends \RdKafka { public function __construct(?Conf $conf = null) {} -#ifdef HAS_RD_KAFKA_TRANSACTIONS /** @tentative-return-type */ public function initTransactions(int $timeout_ms): void {} @@ -116,6 +109,5 @@ public function commitTransaction(int $timeout_ms): void {} /** @tentative-return-type */ public function abortTransaction(int $timeout_ms): void {} -#endif } } diff --git a/rdkafka_arginfo.h b/rdkafka_arginfo.h index 0e4fe52e..ee479b6f 100644 --- a/rdkafka_arginfo.h +++ b/rdkafka_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ea957a110b42c19bcb4a244655c1eaf99a1e3961 */ + * Stub hash: 278f62b10f92f6211d8095be7fb0eef539ecca2e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -22,7 +22,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_getMetadata, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_END_ARG_INFO() -#if defined(HAS_RD_KAFKA_CONTROLLERID) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_getControllerId, 0, 1, IS_LONG, 0) #else @@ -30,7 +29,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_getControllerId, 0, 0, 1) #endif ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_END_ARG_INFO() -#endif #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_getOutQLen, 0, 0, IS_LONG, 0) @@ -60,17 +58,10 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_outqLen arginfo_class_RdKafka_getOutQLen -#if (PHP_VERSION_ID >= 80100) -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_poll, 0, 1, IS_LONG, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_poll, 0, 0, 1) -#endif - ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) -ZEND_END_ARG_INFO() +#define arginfo_class_RdKafka_poll arginfo_class_RdKafka_getControllerId -#define arginfo_class_RdKafka_flush arginfo_class_RdKafka_poll +#define arginfo_class_RdKafka_flush arginfo_class_RdKafka_getControllerId -#if defined(HAS_RD_KAFKA_PURGE) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_purge, 0, 1, IS_LONG, 0) #else @@ -78,7 +69,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_purge, 0, 0, 1) #endif ZEND_ARG_TYPE_INFO(0, purge_flags, IS_LONG, 0) ZEND_END_ARG_INFO() -#endif #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_setLogger, 0, 1, IS_VOID, 0) @@ -119,7 +109,6 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_resumePartitions arginfo_class_RdKafka_pausePartitions -#if defined(HAS_RD_KAFKA_OAUTHBEARER) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_oauthbearerSetToken, 0, 3, IS_VOID, 0) #else @@ -138,7 +127,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_oauthbearerSetTokenFailure, 0, 0, 1 #endif ZEND_ARG_TYPE_INFO(0, error, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Consumer___construct, 0, 0, 0) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, conf, RdKafka\\Conf, 1, "null") @@ -153,7 +141,6 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_Producer___construct arginfo_class_RdKafka_Consumer___construct -#if defined(HAS_RD_KAFKA_TRANSACTIONS) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_Producer_initTransactions, 0, 1, IS_VOID, 0) #else @@ -172,92 +159,76 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_Producer_commitTransaction arginfo_class_RdKafka_Producer_initTransactions #define arginfo_class_RdKafka_Producer_abortTransaction arginfo_class_RdKafka_Producer_initTransactions -#endif + ZEND_METHOD(RdKafka, __construct); ZEND_METHOD(RdKafka, addBrokers); ZEND_METHOD(RdKafka, getMetadata); -#if defined(HAS_RD_KAFKA_CONTROLLERID) ZEND_METHOD(RdKafka, getControllerId); -#endif ZEND_METHOD(RdKafka, getOutQLen); ZEND_METHOD(RdKafka, setLogLevel); ZEND_METHOD(RdKafka, newTopic); ZEND_METHOD(RdKafka, poll); ZEND_METHOD(RdKafka, flush); -#if defined(HAS_RD_KAFKA_PURGE) ZEND_METHOD(RdKafka, purge); -#endif ZEND_METHOD(RdKafka, setLogger); ZEND_METHOD(RdKafka, queryWatermarkOffsets); ZEND_METHOD(RdKafka, offsetsForTimes); ZEND_METHOD(RdKafka, pausePartitions); ZEND_METHOD(RdKafka, resumePartitions); -#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_METHOD(RdKafka, oauthbearerSetToken); ZEND_METHOD(RdKafka, oauthbearerSetTokenFailure); -#endif ZEND_METHOD(RdKafka_Consumer, __construct); ZEND_METHOD(RdKafka_Consumer, newQueue); ZEND_METHOD(RdKafka_Producer, __construct); -#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, initTransactions); ZEND_METHOD(RdKafka_Producer, beginTransaction); ZEND_METHOD(RdKafka_Producer, commitTransaction); ZEND_METHOD(RdKafka_Producer, abortTransaction); -#endif + static const zend_function_entry class_RdKafka_methods[] = { ZEND_ME(RdKafka, __construct, arginfo_class_RdKafka___construct, ZEND_ACC_PRIVATE) ZEND_ME(RdKafka, addBrokers, arginfo_class_RdKafka_addBrokers, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka, getMetadata, arginfo_class_RdKafka_getMetadata, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_CONTROLLERID) ZEND_ME(RdKafka, getControllerId, arginfo_class_RdKafka_getControllerId, ZEND_ACC_PUBLIC) -#endif ZEND_ME(RdKafka, getOutQLen, arginfo_class_RdKafka_getOutQLen, ZEND_ACC_PUBLIC) -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("metadata", zim_RdKafka_getMetadata, arginfo_class_RdKafka_metadata, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, NULL) -#else - ZEND_RAW_FENTRY("metadata", zim_RdKafka_getMetadata, arginfo_class_RdKafka_metadata, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#endif + ZEND_MALIAS(RdKafka, metadata, getMetadata, arginfo_class_RdKafka_metadata, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) ZEND_ME(RdKafka, setLogLevel, arginfo_class_RdKafka_setLogLevel, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) ZEND_ME(RdKafka, newTopic, arginfo_class_RdKafka_newTopic, ZEND_ACC_PUBLIC) -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("outqLen", zim_RdKafka_getOutQLen, arginfo_class_RdKafka_outqLen, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, NULL) -#else - ZEND_RAW_FENTRY("outqLen", zim_RdKafka_getOutQLen, arginfo_class_RdKafka_outqLen, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#endif + ZEND_MALIAS(RdKafka, outqLen, getOutQLen, arginfo_class_RdKafka_outqLen, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) ZEND_ME(RdKafka, poll, arginfo_class_RdKafka_poll, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka, flush, arginfo_class_RdKafka_flush, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_PURGE) ZEND_ME(RdKafka, purge, arginfo_class_RdKafka_purge, ZEND_ACC_PUBLIC) -#endif ZEND_ME(RdKafka, setLogger, arginfo_class_RdKafka_setLogger, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) ZEND_ME(RdKafka, queryWatermarkOffsets, arginfo_class_RdKafka_queryWatermarkOffsets, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka, offsetsForTimes, arginfo_class_RdKafka_offsetsForTimes, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka, pausePartitions, arginfo_class_RdKafka_pausePartitions, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka, resumePartitions, arginfo_class_RdKafka_resumePartitions, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_ME(RdKafka, oauthbearerSetToken, arginfo_class_RdKafka_oauthbearerSetToken, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka, oauthbearerSetTokenFailure, arginfo_class_RdKafka_oauthbearerSetTokenFailure, ZEND_ACC_PUBLIC) -#endif ZEND_FE_END }; + +static const zend_function_entry class_RdKafka_Exception_methods[] = { + ZEND_FE_END +}; + + static const zend_function_entry class_RdKafka_Consumer_methods[] = { ZEND_ME(RdKafka_Consumer, __construct, arginfo_class_RdKafka_Consumer___construct, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Consumer, newQueue, arginfo_class_RdKafka_Consumer_newQueue, ZEND_ACC_PUBLIC) ZEND_FE_END }; + static const zend_function_entry class_RdKafka_Producer_methods[] = { ZEND_ME(RdKafka_Producer, __construct, arginfo_class_RdKafka_Producer___construct, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, initTransactions, arginfo_class_RdKafka_Producer_initTransactions, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Producer, beginTransaction, arginfo_class_RdKafka_Producer_beginTransaction, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Producer, commitTransaction, arginfo_class_RdKafka_Producer_commitTransaction, ZEND_ACC_PUBLIC) ZEND_ME(RdKafka_Producer, abortTransaction, arginfo_class_RdKafka_Producer_abortTransaction, ZEND_ACC_PUBLIC) -#endif ZEND_FE_END }; @@ -266,12 +237,8 @@ static zend_class_entry *register_class_RdKafka(void) zend_class_entry ce, *class_entry; INIT_CLASS_ENTRY(ce, "RdKafka", class_RdKafka_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, ZEND_ACC_ABSTRACT); -#else class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_ABSTRACT; -#endif zval property_error_cb_default_value; ZVAL_UNDEF(&property_error_cb_default_value); @@ -292,12 +259,8 @@ static zend_class_entry *register_class_RdKafka_Exception(zend_class_entry *clas { zend_class_entry ce, *class_entry; - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Exception", NULL); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, class_entry_Exception, 0); -#else + INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Exception", class_RdKafka_Exception_methods); class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); -#endif return class_entry; } @@ -307,11 +270,7 @@ static zend_class_entry *register_class_RdKafka_Consumer(zend_class_entry *class zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Consumer", class_RdKafka_Consumer_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, class_entry_RdKafka, 0); -#else class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka); -#endif return class_entry; } @@ -321,11 +280,7 @@ static zend_class_entry *register_class_RdKafka_Producer(zend_class_entry *class zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Producer", class_RdKafka_Producer_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, class_entry_RdKafka, 0); -#else class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka); -#endif return class_entry; } diff --git a/rdkafka_legacy_arginfo.h b/rdkafka_legacy_arginfo.h deleted file mode 100644 index 49f594b4..00000000 --- a/rdkafka_legacy_arginfo.h +++ /dev/null @@ -1,262 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: ea957a110b42c19bcb4a244655c1eaf99a1e3961 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_addBrokers, 0, 0, 1) - ZEND_ARG_INFO(0, broker_list) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_getMetadata, 0, 0, 3) - ZEND_ARG_INFO(0, all_topics) - ZEND_ARG_INFO(0, only_topic) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -#if defined(HAS_RD_KAFKA_CONTROLLERID) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_getControllerId, 0, 0, 1) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_getOutQLen, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_metadata arginfo_class_RdKafka_getMetadata - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_setLogLevel, 0, 0, 1) - ZEND_ARG_INFO(0, level) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_newTopic, 0, 0, 1) - ZEND_ARG_INFO(0, topic_name) - ZEND_ARG_INFO(0, topic_conf) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_outqLen arginfo_class_RdKafka_getOutQLen - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_poll, 0, 0, 1) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_flush arginfo_class_RdKafka_poll - -#if defined(HAS_RD_KAFKA_PURGE) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_purge, 0, 0, 1) - ZEND_ARG_INFO(0, purge_flags) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_setLogger, 0, 0, 1) - ZEND_ARG_INFO(0, logger) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_queryWatermarkOffsets, 0, 0, 5) - ZEND_ARG_INFO(0, topic) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(1, low) - ZEND_ARG_INFO(1, high) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_offsetsForTimes, 0, 0, 2) - ZEND_ARG_INFO(0, topic_partitions) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_pausePartitions, 0, 0, 1) - ZEND_ARG_INFO(0, topic_partitions) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_resumePartitions arginfo_class_RdKafka_pausePartitions - -#if defined(HAS_RD_KAFKA_OAUTHBEARER) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_oauthbearerSetToken, 0, 0, 3) - ZEND_ARG_INFO(0, token_value) - ZEND_ARG_INFO(0, lifetime_ms) - ZEND_ARG_INFO(0, principal_name) - ZEND_ARG_INFO(0, extensions) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_oauthbearerSetTokenFailure, 0, 0, 1) - ZEND_ARG_INFO(0, error) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Consumer___construct, 0, 0, 0) - ZEND_ARG_INFO(0, conf) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Consumer_newQueue arginfo_class_RdKafka_getOutQLen - -#define arginfo_class_RdKafka_Producer___construct arginfo_class_RdKafka_Consumer___construct - -#if defined(HAS_RD_KAFKA_TRANSACTIONS) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Producer_initTransactions, 0, 0, 1) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Producer_beginTransaction, 0, 0, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_Producer_commitTransaction arginfo_class_RdKafka_Producer_initTransactions - -#define arginfo_class_RdKafka_Producer_abortTransaction arginfo_class_RdKafka_Producer_initTransactions -#endif - -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka, addBrokers); -ZEND_METHOD(RdKafka, getMetadata); -#if defined(HAS_RD_KAFKA_CONTROLLERID) -ZEND_METHOD(RdKafka, getControllerId); -#endif -ZEND_METHOD(RdKafka, getOutQLen); -ZEND_METHOD(RdKafka, setLogLevel); -ZEND_METHOD(RdKafka, newTopic); -ZEND_METHOD(RdKafka, poll); -ZEND_METHOD(RdKafka, flush); -#if defined(HAS_RD_KAFKA_PURGE) -ZEND_METHOD(RdKafka, purge); -#endif -ZEND_METHOD(RdKafka, setLogger); -ZEND_METHOD(RdKafka, queryWatermarkOffsets); -ZEND_METHOD(RdKafka, offsetsForTimes); -ZEND_METHOD(RdKafka, pausePartitions); -ZEND_METHOD(RdKafka, resumePartitions); -#if defined(HAS_RD_KAFKA_OAUTHBEARER) -ZEND_METHOD(RdKafka, oauthbearerSetToken); -ZEND_METHOD(RdKafka, oauthbearerSetTokenFailure); -#endif -ZEND_METHOD(RdKafka_Consumer, __construct); -ZEND_METHOD(RdKafka_Consumer, newQueue); -ZEND_METHOD(RdKafka_Producer, __construct); -#if defined(HAS_RD_KAFKA_TRANSACTIONS) -ZEND_METHOD(RdKafka_Producer, initTransactions); -ZEND_METHOD(RdKafka_Producer, beginTransaction); -ZEND_METHOD(RdKafka_Producer, commitTransaction); -ZEND_METHOD(RdKafka_Producer, abortTransaction); -#endif - -static const zend_function_entry class_RdKafka_methods[] = { - ZEND_ME(RdKafka, __construct, arginfo_class_RdKafka___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka, addBrokers, arginfo_class_RdKafka_addBrokers, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka, getMetadata, arginfo_class_RdKafka_getMetadata, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_CONTROLLERID) - ZEND_ME(RdKafka, getControllerId, arginfo_class_RdKafka_getControllerId, ZEND_ACC_PUBLIC) -#endif - ZEND_ME(RdKafka, getOutQLen, arginfo_class_RdKafka_getOutQLen, ZEND_ACC_PUBLIC) -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("metadata", zim_RdKafka_getMetadata, arginfo_class_RdKafka_metadata, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, NULL) -#else - ZEND_RAW_FENTRY("metadata", zim_RdKafka_getMetadata, arginfo_class_RdKafka_metadata, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#endif - ZEND_ME(RdKafka, setLogLevel, arginfo_class_RdKafka_setLogLevel, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) - ZEND_ME(RdKafka, newTopic, arginfo_class_RdKafka_newTopic, ZEND_ACC_PUBLIC) -#if (PHP_VERSION_ID >= 80400) - ZEND_RAW_FENTRY("outqLen", zim_RdKafka_getOutQLen, arginfo_class_RdKafka_outqLen, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, NULL) -#else - ZEND_RAW_FENTRY("outqLen", zim_RdKafka_getOutQLen, arginfo_class_RdKafka_outqLen, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#endif - ZEND_ME(RdKafka, poll, arginfo_class_RdKafka_poll, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka, flush, arginfo_class_RdKafka_flush, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_PURGE) - ZEND_ME(RdKafka, purge, arginfo_class_RdKafka_purge, ZEND_ACC_PUBLIC) -#endif - ZEND_ME(RdKafka, setLogger, arginfo_class_RdKafka_setLogger, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) - ZEND_ME(RdKafka, queryWatermarkOffsets, arginfo_class_RdKafka_queryWatermarkOffsets, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka, offsetsForTimes, arginfo_class_RdKafka_offsetsForTimes, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka, pausePartitions, arginfo_class_RdKafka_pausePartitions, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka, resumePartitions, arginfo_class_RdKafka_resumePartitions, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_OAUTHBEARER) - ZEND_ME(RdKafka, oauthbearerSetToken, arginfo_class_RdKafka_oauthbearerSetToken, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka, oauthbearerSetTokenFailure, arginfo_class_RdKafka_oauthbearerSetTokenFailure, ZEND_ACC_PUBLIC) -#endif - ZEND_FE_END -}; - -static const zend_function_entry class_RdKafka_Consumer_methods[] = { - ZEND_ME(RdKafka_Consumer, __construct, arginfo_class_RdKafka_Consumer___construct, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Consumer, newQueue, arginfo_class_RdKafka_Consumer_newQueue, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static const zend_function_entry class_RdKafka_Producer_methods[] = { - ZEND_ME(RdKafka_Producer, __construct, arginfo_class_RdKafka_Producer___construct, ZEND_ACC_PUBLIC) -#if defined(HAS_RD_KAFKA_TRANSACTIONS) - ZEND_ME(RdKafka_Producer, initTransactions, arginfo_class_RdKafka_Producer_initTransactions, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Producer, beginTransaction, arginfo_class_RdKafka_Producer_beginTransaction, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Producer, commitTransaction, arginfo_class_RdKafka_Producer_commitTransaction, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_Producer, abortTransaction, arginfo_class_RdKafka_Producer_abortTransaction, ZEND_ACC_PUBLIC) -#endif - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka(void) -{ - zend_class_entry ce, *class_entry; - - INIT_CLASS_ENTRY(ce, "RdKafka", class_RdKafka_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, NULL, ZEND_ACC_ABSTRACT); -#else - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_ABSTRACT; -#endif - - zval property_error_cb_default_value; - ZVAL_NULL(&property_error_cb_default_value); - zend_string *property_error_cb_name = zend_string_init("error_cb", sizeof("error_cb") - 1, 1); - zend_declare_property_ex(class_entry, property_error_cb_name, &property_error_cb_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_error_cb_name); - - zval property_dr_cb_default_value; - ZVAL_NULL(&property_dr_cb_default_value); - zend_string *property_dr_cb_name = zend_string_init("dr_cb", sizeof("dr_cb") - 1, 1); - zend_declare_property_ex(class_entry, property_dr_cb_name, &property_dr_cb_default_value, ZEND_ACC_PRIVATE, NULL); - zend_string_release(property_dr_cb_name); - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_Exception(zend_class_entry *class_entry_Exception) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Exception", NULL); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, class_entry_Exception, 0); -#else - class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); -#endif - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_Consumer(zend_class_entry *class_entry_RdKafka) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Consumer", class_RdKafka_Consumer_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, class_entry_RdKafka, 0); -#else - class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka); -#endif - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_Producer(zend_class_entry *class_entry_RdKafka) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Producer", class_RdKafka_Producer_methods); -#if (PHP_VERSION_ID >= 80400) - class_entry = zend_register_internal_class_with_flags(&ce, class_entry_RdKafka, 0); -#else - class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka); -#endif - - return class_entry; -} diff --git a/tests/bug115.phpt b/tests/bug115.phpt index 8c1620d1..1764cc2b 100644 --- a/tests/bug115.phpt +++ b/tests/bug115.phpt @@ -10,7 +10,7 @@ require __DIR__ . '/integration-tests-check.php'; $delivered = 0; $conf = new RdKafka\Conf(); -if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->setErrorCb(function ($producer, $err, $errstr) { diff --git a/tests/bug465.phpt b/tests/bug465.phpt index 68f3f107..128c4008 100644 --- a/tests/bug465.phpt +++ b/tests/bug465.phpt @@ -18,7 +18,7 @@ var_dump($n > 0); function getTopics() { $conf = new RdKafka\Conf(); - if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { + if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/tests/bug521.phpt b/tests/bug521.phpt index 399115f8..c2e99235 100644 --- a/tests/bug521.phpt +++ b/tests/bug521.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #521 ---SKIPIF-- - --FILE-- = 0x090000 && RD_KAFKA_VERSION < 0x010100ff) || die("skip librdkafka too old"); --FILE-- = 0x090000 || die("skip librdkafka too old"); (!isset($_ENV['TESTS_DONT_SKIP_RISKY']) || $_ENV['TESTS_DONT_SKIP_RISKY']) && die("skip Risky/broken test"); require __DIR__ . '/integration-tests-check.php'; --FILE-- diff --git a/tests/conf_callbacks_rdkafka11.phpt b/tests/conf_callbacks_rdkafka11.phpt index 1e7b72fa..cc2d063b 100644 --- a/tests/conf_callbacks_rdkafka11.phpt +++ b/tests/conf_callbacks_rdkafka11.phpt @@ -1,8 +1,5 @@ --TEST-- RdKafka\Conf ---SKIPIF-- -= 0x010100ff || die("skip librdkafka too old"); --FILE-- --FILE-- setDefaultTopicConf(new RdKafka\TopicConf()); echo "Setting invalid topic conf\n"; -$conf->setDefaultTopicConf($conf); +try { + $conf->setDefaultTopicConf($conf); +} catch (Error $e) { + printf("%s: %s\n", $e::class, $e->getMessage()); +} --EXPECTF-- Setting valid topic conf -Deprecated: Function RdKafka\Conf::setDefaultTopicConf() is deprecated in %s%econf_setDefaultTopicConf.php on line 6 +Deprecated: Method RdKafka\Conf::setDefaultTopicConf() is deprecated in %s%econf_setDefaultTopicConf.php on line 6 Setting invalid topic conf -Deprecated: Function RdKafka\Conf::setDefaultTopicConf() is deprecated in %s%econf_setDefaultTopicConf.php on line 9 - -Warning: RdKafka\Conf::setDefaultTopicConf() expects parameter 1 to be RdKafka\TopicConf, object given in %s%econf_setDefaultTopicConf.php on line 9 - +Deprecated: Method RdKafka\Conf::setDefaultTopicConf() is deprecated in %s%econf_setDefaultTopicConf.php on line 10 +TypeError: RdKafka\Conf::setDefaultTopicConf(): Argument #1 ($topic_conf) must be of type RdKafka\TopicConf, RdKafka\Conf given diff --git a/tests/controller_id.phpt b/tests/controller_id.phpt index b9724804..f8a793a4 100644 --- a/tests/controller_id.phpt +++ b/tests/controller_id.phpt @@ -3,7 +3,7 @@ Display controller id --SKIPIF-- --FILE-- getControllerId(10*1000) . \PHP_EOL; --EXPECT-- 1 1 -1 \ No newline at end of file +1 diff --git a/tests/init_transaction_not_configured.phpt b/tests/init_transaction_not_configured.phpt index e0a28f3d..e7b2d598 100644 --- a/tests/init_transaction_not_configured.phpt +++ b/tests/init_transaction_not_configured.phpt @@ -11,7 +11,7 @@ if (!class_exists("RdKafka\\KafkaErrorException")) { require __DIR__ . '/integration-tests-check.php'; $conf = new RdKafka\Conf(); -if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } diff --git a/tests/message_headers.phpt b/tests/message_headers.phpt index eaf0078c..17e9d928 100644 --- a/tests/message_headers.phpt +++ b/tests/message_headers.phpt @@ -2,8 +2,8 @@ Message headers --SKIPIF-- = 0x000b04ff || die("skip librdkafka too old"); require __DIR__ . '/integration-tests-check.php'; +?> --FILE-- = 0x01010000 || die("skip librdkafka too old does not support oauthbearer"); +?> --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_OAUTH_BROKERS')); diff --git a/tests/produce_consume.phpt b/tests/produce_consume.phpt index 0782109e..b11a162e 100644 --- a/tests/produce_consume.phpt +++ b/tests/produce_consume.phpt @@ -10,7 +10,7 @@ require __DIR__ . '/integration-tests-check.php'; $delivered = 0; $conf = new RdKafka\Conf(); -if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->setErrorCb(function ($producer, $err, $errstr) { diff --git a/tests/produce_consume_queue.phpt b/tests/produce_consume_queue.phpt index ff119849..112fa130 100644 --- a/tests/produce_consume_queue.phpt +++ b/tests/produce_consume_queue.phpt @@ -10,7 +10,7 @@ require __DIR__ . '/integration-tests-check.php'; $delivered = 0; $conf = new RdKafka\Conf(); -if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->setErrorCb(function ($producer, $err, $errstr) { @@ -54,7 +54,7 @@ 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')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->setErrorCb(function ($producer, $err, $errstr) { diff --git a/tests/produce_consume_transactional.phpt b/tests/produce_consume_transactional.phpt index 48d2545e..805446a0 100644 --- a/tests/produce_consume_transactional.phpt +++ b/tests/produce_consume_transactional.phpt @@ -14,7 +14,7 @@ $delivered = 0; $conf = new RdKafka\Conf(); $conf->set('transactional.id', 'transactional-producer'); -if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->setLogCb(function ($kafka, $level, $facility, $message) {}); diff --git a/tests/produce_opaque.phpt b/tests/produce_opaque.phpt index 8c37399b..3eea8b7a 100644 --- a/tests/produce_opaque.phpt +++ b/tests/produce_opaque.phpt @@ -3,13 +3,13 @@ Produce with opaque --SKIPIF-- --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/tests/produce_opaque_noconf.phpt b/tests/produce_opaque_noconf.phpt deleted file mode 100644 index 4ebaeb51..00000000 --- a/tests/produce_opaque_noconf.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Produce with opaque, no conf ---SKIPIF-- -= 0x1050000 && die("skip librdkafka >= 1.5.0"); ---FILE-- -addBrokers(getenv('TEST_KAFKA_BROKERS'))); - -$topicName = sprintf("test_rdkafka_%s", uniqid()); - -$topic = $producer->newTopic($topicName); - -if (!$producer->getMetadata(false, $topic, 10*1000)) { - echo "Failed to get metadata, is broker down?\n"; -} - -for ($i = 0; $i < 10; $i++) { - $topic->produce(0, 0, "message $i", null, "opaque $i"); -} - -echo "Expect no leaks\n"; ---EXPECT-- -int(1) -Expect no leaks diff --git a/tests/produce_opaque_noflush.phpt b/tests/produce_opaque_noflush.phpt index 9b3f5309..37a2d735 100644 --- a/tests/produce_opaque_noflush.phpt +++ b/tests/produce_opaque_noflush.phpt @@ -3,13 +3,13 @@ Produce with opaque, no flush --SKIPIF-- --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/tests/produce_opaque_noflush_dr_callback.phpt b/tests/produce_opaque_noflush_dr_callback.phpt index f4108405..b48c88bf 100644 --- a/tests/produce_opaque_noflush_dr_callback.phpt +++ b/tests/produce_opaque_noflush_dr_callback.phpt @@ -3,13 +3,13 @@ Produce with opaque, no flush, with delivery callback --SKIPIF-- --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/tests/produce_opaque_purge.phpt b/tests/produce_opaque_purge.phpt index fe3ab599..7957ac25 100644 --- a/tests/produce_opaque_purge.phpt +++ b/tests/produce_opaque_purge.phpt @@ -3,13 +3,13 @@ Produce with opaque, purge queued/inflight messages --SKIPIF-- --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/tests/produce_opaque_purge_dr_callback.phpt b/tests/produce_opaque_purge_dr_callback.phpt index ff050200..ec3d65ad 100644 --- a/tests/produce_opaque_purge_dr_callback.phpt +++ b/tests/produce_opaque_purge_dr_callback.phpt @@ -3,13 +3,13 @@ Produce with opaque, purge queued/inflight messages, with delivery callback --SKIPIF-- --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/tests/producev_opaque.phpt b/tests/producev_opaque.phpt index 6fcc108e..85dd32c1 100644 --- a/tests/producev_opaque.phpt +++ b/tests/producev_opaque.phpt @@ -3,13 +3,13 @@ Producev with opaque --SKIPIF-- --FILE-- = 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { +if (false !== getenv('TEST_KAFKA_BROKER_VERSION')) { $conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); } $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); diff --git a/topic.c b/topic.c index f1c0f7f0..6263ee9f 100644 --- a/topic.c +++ b/topic.c @@ -31,11 +31,7 @@ #include "topic.h" #include "queue.h" #include "message.h" -#if PHP_VERSION_ID < 80000 -#include "topic_legacy_arginfo.h" -#else #include "topic_arginfo.h" -#endif static zend_object_handlers object_handlers; zend_class_entry * ce_kafka_consumer_topic; @@ -439,19 +435,13 @@ PHP_METHOD(RdKafka_ProducerTopic, produce) rd_kafka_resp_err_t err; kafka_topic_object *intern; -#ifdef HAS_RD_KAFKA_PURGE ZEND_PARSE_PARAMETERS_START(2, 5) -#else - ZEND_PARSE_PARAMETERS_START(2, 4) -#endif Z_PARAM_LONG(partition) Z_PARAM_LONG(msgflags) Z_PARAM_OPTIONAL Z_PARAM_STRING_OR_NULL(payload, payload_len) Z_PARAM_STRING_OR_NULL(key, key_len) -#ifdef HAS_RD_KAFKA_PURGE Z_PARAM_STR_OR_NULL(opaque) -#endif ZEND_PARSE_PARAMETERS_END(); if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { @@ -483,7 +473,6 @@ PHP_METHOD(RdKafka_ProducerTopic, produce) } /* }}} */ -#ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS /* {{{ proto void RdKafka\ProducerTopic::producev(int $partition, int $msgflags[, string $payload[, string $key[, array $headers[, int $timestamp_ms[, string msg_opaque]]]]]) Produce and send a single message to broker (with headers possibility and timestamp). */ PHP_METHOD(RdKafka_ProducerTopic, producev) @@ -506,11 +495,7 @@ PHP_METHOD(RdKafka_ProducerTopic, producev) zend_bool timestamp_ms_is_null = 0; zend_string *opaque = NULL; -#ifdef HAS_RD_KAFKA_PURGE ZEND_PARSE_PARAMETERS_START(2, 7) -#else - ZEND_PARSE_PARAMETERS_START(2, 6) -#endif Z_PARAM_LONG(partition) Z_PARAM_LONG(msgflags) Z_PARAM_OPTIONAL @@ -518,9 +503,7 @@ PHP_METHOD(RdKafka_ProducerTopic, producev) Z_PARAM_STRING_OR_NULL(key, key_len) Z_PARAM_ARRAY_HT_OR_NULL(headersParam) Z_PARAM_LONG_OR_NULL(timestamp_ms, timestamp_ms_is_null) -#ifdef HAS_RD_KAFKA_PURGE Z_PARAM_STR_OR_NULL(opaque) -#endif ZEND_PARSE_PARAMETERS_END(); if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { @@ -590,7 +573,6 @@ PHP_METHOD(RdKafka_ProducerTopic, producev) } } /* }}} */ -#endif /* {{{ proto string RdKafka\Topic::getName() */ PHP_METHOD(RdKafka_Topic, getName) diff --git a/topic.stub.php b/topic.stub.php index 0e1a5e9d..a29ebde9 100644 --- a/topic.stub.php +++ b/topic.stub.php @@ -61,8 +61,6 @@ private function __construct() {} /** @tentative-return-type */ public function produce(int $partition, int $msgflags, ?string $payload = null, ?string $key = null, ?string $msg_opaque = null): void {} -#ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS /** @tentative-return-type */ public function producev(int $partition, int $msgflags, ?string $payload = null, ?string $key = null, ?array $headers = null, ?int $timestamp_ms = null, ?string $msg_opaque = null): void {} -#endif } diff --git a/topic_arginfo.h b/topic_arginfo.h index 9307053c..19200aad 100644 --- a/topic_arginfo.h +++ b/topic_arginfo.h @@ -1,39 +1,67 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7d23f208609b509bb75f8286fc5c93c127c406d6 */ + * Stub hash: 552619ee1c20d5c1bf1286578c2825ed3d1164d1 */ +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_Topic_getName, 0, 0, IS_STRING, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Topic_getName, 0, 0, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic___construct, 0, 0, 0) ZEND_END_ARG_INFO() +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeQueueStart, 0, 3, IS_VOID, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeQueueStart, 0, 0, 3) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, queue, RdKafka\\Queue, 0) ZEND_END_ARG_INFO() +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeCallback, 0, 3, IS_LONG, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeCallback, 0, 0, 3) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) ZEND_END_ARG_INFO() +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeStart, 0, 2, IS_VOID, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeStart, 0, 0, 2) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) ZEND_END_ARG_INFO() +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeStop, 0, 1, IS_VOID, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeStop, 0, 0, 1) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_END_ARG_INFO() +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consume, 0, 2, RdKafka\\Message, 1) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consume, 0, 0, 2) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_END_ARG_INFO() +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeBatch, 0, 3, IS_ARRAY, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeBatch, 0, 0, 3) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, batch_size, IS_LONG, 0) @@ -47,7 +75,11 @@ ZEND_END_ARG_INFO() #define arginfo_class_RdKafka_ProducerTopic___construct arginfo_class_RdKafka_ConsumerTopic___construct +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ProducerTopic_produce, 0, 2, IS_VOID, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ProducerTopic_produce, 0, 0, 2) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, msgflags, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, payload, IS_STRING, 1, "null") @@ -55,8 +87,11 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_Producer ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, msg_opaque, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -#if defined(HAVE_RD_KAFKA_MESSAGE_HEADERS) +#if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_ProducerTopic_producev, 0, 2, IS_VOID, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ProducerTopic_producev, 0, 0, 2) +#endif ZEND_ARG_TYPE_INFO(0, partition, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, msgflags, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, payload, IS_STRING, 1, "null") @@ -65,7 +100,6 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_Producer ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_ms, IS_LONG, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, msg_opaque, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -#endif ZEND_METHOD(RdKafka_Topic, getName); @@ -78,9 +112,7 @@ ZEND_METHOD(RdKafka_ConsumerTopic, consume); ZEND_METHOD(RdKafka_ConsumerTopic, consumeBatch); ZEND_METHOD(RdKafka_ConsumerTopic, offsetStore); ZEND_METHOD(RdKafka_ProducerTopic, produce); -#if defined(HAVE_RD_KAFKA_MESSAGE_HEADERS) ZEND_METHOD(RdKafka_ProducerTopic, producev); -#endif static const zend_function_entry class_RdKafka_Topic_methods[] = { @@ -112,9 +144,7 @@ static const zend_function_entry class_RdKafka_KafkaConsumerTopic_methods[] = { static const zend_function_entry class_RdKafka_ProducerTopic_methods[] = { ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_ProducerTopic___construct, ZEND_ACC_PRIVATE) ZEND_ME(RdKafka_ProducerTopic, produce, arginfo_class_RdKafka_ProducerTopic_produce, ZEND_ACC_PUBLIC) -#if defined(HAVE_RD_KAFKA_MESSAGE_HEADERS) ZEND_ME(RdKafka_ProducerTopic, producev, arginfo_class_RdKafka_ProducerTopic_producev, ZEND_ACC_PUBLIC) -#endif ZEND_FE_END }; diff --git a/topic_legacy_arginfo.h b/topic_legacy_arginfo.h deleted file mode 100644 index 0f6c83e5..00000000 --- a/topic_legacy_arginfo.h +++ /dev/null @@ -1,160 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7d23f208609b509bb75f8286fc5c93c127c406d6 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Topic_getName, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeQueueStart, 0, 0, 3) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, queue) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeCallback, 0, 0, 3) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, timeout_ms) - ZEND_ARG_INFO(0, callback) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeStart, 0, 0, 2) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeStop, 0, 0, 1) - ZEND_ARG_INFO(0, partition) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consume, 0, 0, 2) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, timeout_ms) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ConsumerTopic_consumeBatch, 0, 0, 3) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, timeout_ms) - ZEND_ARG_INFO(0, batch_size) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_ConsumerTopic_offsetStore arginfo_class_RdKafka_ConsumerTopic_consumeStart - -#define arginfo_class_RdKafka_KafkaConsumerTopic___construct arginfo_class_RdKafka_ConsumerTopic___construct - -#define arginfo_class_RdKafka_KafkaConsumerTopic_offsetStore arginfo_class_RdKafka_ConsumerTopic_consumeStart - -#define arginfo_class_RdKafka_ProducerTopic___construct arginfo_class_RdKafka_ConsumerTopic___construct - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ProducerTopic_produce, 0, 0, 2) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, msgflags) - ZEND_ARG_INFO(0, payload) - ZEND_ARG_INFO(0, key) - ZEND_ARG_INFO(0, msg_opaque) -ZEND_END_ARG_INFO() - -#if defined(HAVE_RD_KAFKA_MESSAGE_HEADERS) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_ProducerTopic_producev, 0, 0, 2) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, msgflags) - ZEND_ARG_INFO(0, payload) - ZEND_ARG_INFO(0, key) - ZEND_ARG_INFO(0, headers) - ZEND_ARG_INFO(0, timestamp_ms) - ZEND_ARG_INFO(0, msg_opaque) -ZEND_END_ARG_INFO() -#endif - - -ZEND_METHOD(RdKafka_Topic, getName); -ZEND_METHOD(RdKafka, __construct); -ZEND_METHOD(RdKafka_ConsumerTopic, consumeQueueStart); -ZEND_METHOD(RdKafka_ConsumerTopic, consumeCallback); -ZEND_METHOD(RdKafka_ConsumerTopic, consumeStart); -ZEND_METHOD(RdKafka_ConsumerTopic, consumeStop); -ZEND_METHOD(RdKafka_ConsumerTopic, consume); -ZEND_METHOD(RdKafka_ConsumerTopic, consumeBatch); -ZEND_METHOD(RdKafka_ConsumerTopic, offsetStore); -ZEND_METHOD(RdKafka_ProducerTopic, produce); -#if defined(HAVE_RD_KAFKA_MESSAGE_HEADERS) -ZEND_METHOD(RdKafka_ProducerTopic, producev); -#endif - - -static const zend_function_entry class_RdKafka_Topic_methods[] = { - ZEND_ME(RdKafka_Topic, getName, arginfo_class_RdKafka_Topic_getName, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - -static const zend_function_entry class_RdKafka_ConsumerTopic_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_ConsumerTopic___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_ConsumerTopic, consumeQueueStart, arginfo_class_RdKafka_ConsumerTopic_consumeQueueStart, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_ConsumerTopic, consumeCallback, arginfo_class_RdKafka_ConsumerTopic_consumeCallback, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_ConsumerTopic, consumeStart, arginfo_class_RdKafka_ConsumerTopic_consumeStart, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_ConsumerTopic, consumeStop, arginfo_class_RdKafka_ConsumerTopic_consumeStop, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_ConsumerTopic, consume, arginfo_class_RdKafka_ConsumerTopic_consume, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_ConsumerTopic, consumeBatch, arginfo_class_RdKafka_ConsumerTopic_consumeBatch, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_ConsumerTopic, offsetStore, arginfo_class_RdKafka_ConsumerTopic_offsetStore, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - -static const zend_function_entry class_RdKafka_KafkaConsumerTopic_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_KafkaConsumerTopic___construct, ZEND_ACC_PRIVATE) - ZEND_MALIAS(RdKafka_ConsumerTopic, offsetStore, offsetStore, arginfo_class_RdKafka_KafkaConsumerTopic_offsetStore, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - -static const zend_function_entry class_RdKafka_ProducerTopic_methods[] = { - ZEND_MALIAS(RdKafka, __construct, __construct, arginfo_class_RdKafka_ProducerTopic___construct, ZEND_ACC_PRIVATE) - ZEND_ME(RdKafka_ProducerTopic, produce, arginfo_class_RdKafka_ProducerTopic_produce, ZEND_ACC_PUBLIC) -#if defined(HAVE_RD_KAFKA_MESSAGE_HEADERS) - ZEND_ME(RdKafka_ProducerTopic, producev, arginfo_class_RdKafka_ProducerTopic_producev, ZEND_ACC_PUBLIC) -#endif - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_Topic(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "Topic", class_RdKafka_Topic_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_ABSTRACT; - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_ConsumerTopic(zend_class_entry *class_entry_RdKafka_Topic) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "ConsumerTopic", class_RdKafka_ConsumerTopic_methods); - class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka_Topic); - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_KafkaConsumerTopic(zend_class_entry *class_entry_RdKafka_Topic) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "KafkaConsumerTopic", class_RdKafka_KafkaConsumerTopic_methods); - class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka_Topic); - - return class_entry; -} - -static zend_class_entry *register_class_RdKafka_ProducerTopic(zend_class_entry *class_entry_RdKafka_Topic) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "ProducerTopic", class_RdKafka_ProducerTopic_methods); - class_entry = zend_register_internal_class_ex(&ce, class_entry_RdKafka_Topic); - - return class_entry; -} diff --git a/topic_partition.c b/topic_partition.c index 268364e2..c4f7c9ab 100644 --- a/topic_partition.c +++ b/topic_partition.c @@ -29,12 +29,7 @@ #include "Zend/zend_exceptions.h" #include "ext/spl/spl_exceptions.h" #include "topic_partition.h" - -#if PHP_VERSION_ID < 80000 -#include "topic_partition_legacy_arginfo.h" -#else #include "topic_partition_arginfo.h" -#endif typedef kafka_topic_partition_intern object_intern; diff --git a/topic_partition_legacy_arginfo.h b/topic_partition_legacy_arginfo.h deleted file mode 100644 index f8ef29b9..00000000 --- a/topic_partition_legacy_arginfo.h +++ /dev/null @@ -1,62 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7c722b9eb9357157d89a14431ebcfd79cc6f1116 */ - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicPartition___construct, 0, 0, 2) - ZEND_ARG_INFO(0, topic) - ZEND_ARG_INFO(0, partition) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicPartition_getTopic, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicPartition_setTopic, 0, 0, 1) - ZEND_ARG_INFO(0, topic_name) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_TopicPartition_getPartition arginfo_class_RdKafka_TopicPartition_getTopic - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicPartition_setPartition, 0, 0, 1) - ZEND_ARG_INFO(0, partition) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_TopicPartition_getOffset arginfo_class_RdKafka_TopicPartition_getTopic - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_TopicPartition_setOffset, 0, 0, 1) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -#define arginfo_class_RdKafka_TopicPartition_getErr arginfo_class_RdKafka_TopicPartition_getTopic - - -ZEND_METHOD(RdKafka_TopicPartition, __construct); -ZEND_METHOD(RdKafka_TopicPartition, getTopic); -ZEND_METHOD(RdKafka_TopicPartition, setTopic); -ZEND_METHOD(RdKafka_TopicPartition, getPartition); -ZEND_METHOD(RdKafka_TopicPartition, setPartition); -ZEND_METHOD(RdKafka_TopicPartition, getOffset); -ZEND_METHOD(RdKafka_TopicPartition, setOffset); -ZEND_METHOD(RdKafka_TopicPartition, getErr); - - -static const zend_function_entry class_RdKafka_TopicPartition_methods[] = { - ZEND_ME(RdKafka_TopicPartition, __construct, arginfo_class_RdKafka_TopicPartition___construct, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, getTopic, arginfo_class_RdKafka_TopicPartition_getTopic, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, setTopic, arginfo_class_RdKafka_TopicPartition_setTopic, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, getPartition, arginfo_class_RdKafka_TopicPartition_getPartition, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, setPartition, arginfo_class_RdKafka_TopicPartition_setPartition, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, getOffset, arginfo_class_RdKafka_TopicPartition_getOffset, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, setOffset, arginfo_class_RdKafka_TopicPartition_setOffset, ZEND_ACC_PUBLIC) - ZEND_ME(RdKafka_TopicPartition, getErr, arginfo_class_RdKafka_TopicPartition_getErr, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_RdKafka_TopicPartition(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "RdKafka", "TopicPartition", class_RdKafka_TopicPartition_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - - return class_entry; -}