From 257b7adc3cdcec3a95b1c65073621357beb1f1f0 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Fri, 25 Oct 2024 17:05:20 +0200 Subject: [PATCH] fixup! Fix X32 build --- rdkafka.c | 17 ++++++-- rdkafka.stub.php | 2 +- rdkafka_arginfo.h | 67 ++++++++++++++++------------- rdkafka_legacy_arginfo.h | 69 +++++++++++++++++------------- tests/oauthbearer_integration.phpt | 3 +- 5 files changed, 94 insertions(+), 64 deletions(-) diff --git a/rdkafka.c b/rdkafka.c index 783de1b1..7caaa0d7 100644 --- a/rdkafka.c +++ b/rdkafka.c @@ -432,7 +432,7 @@ PHP_METHOD(RdKafka, setLogLevel) /* }}} */ #ifdef HAS_RD_KAFKA_OAUTHBEARER -/* {{{ proto void RdKafka::oauthbearerSetToken(string $token_value, int $lifetime_ms, string $principal_name, array $extensions = []) +/* {{{ proto void RdKafka::oauthbearerSetToken(string $token_value, int|float $lifetime_ms, string $principal_name, array $extensions = []) * Set SASL/OAUTHBEARER token and metadata * * The SASL/OAUTHBEARER token refresh callback or event handler should cause @@ -449,7 +449,8 @@ PHP_METHOD(RdKafka, oauthbearerSetToken) kafka_object *intern; char *token_value; size_t token_value_len; - zend_long lifetime_ms; + zval *zlifetime_ms; + int64_t lifetime_ms; char *principal_name; size_t principal_len; HashTable *extensions_hash = NULL; @@ -457,10 +458,20 @@ PHP_METHOD(RdKafka, oauthbearerSetToken) char errstr[512]; rd_kafka_resp_err_t ret = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sls|h", &token_value, &token_value_len, &lifetime_ms, &principal_name, &principal_len, &extensions_hash) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "szs|h", &token_value, &token_value_len, &zlifetime_ms, &principal_name, &principal_len, &extensions_hash) == FAILURE) { return; } + switch (Z_TYPE_P(zlifetime_ms)) { + case IS_LONG: + lifetime_ms = (int64_t) Z_LVAL_P(zlifetime_ms); + break; + case IS_DOUBLE: + lifetime_ms = (int64_t) Z_DVAL_P(zlifetime_ms); + break; + EMPTY_SWITCH_DEFAULT_CASE(); + } + intern = get_kafka_object(getThis()); if (!intern) { return; diff --git a/rdkafka.stub.php b/rdkafka.stub.php index 3d99ef22..5d12e430 100644 --- a/rdkafka.stub.php +++ b/rdkafka.stub.php @@ -82,7 +82,7 @@ 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 {} + public function oauthbearerSetToken(string $token_value, int|float $lifetime_ms, string $principal_name, array $extensions = []): void {} /** @tentative-return-type */ public function oauthbearerSetTokenFailure(string $error): void {} diff --git a/rdkafka_arginfo.h b/rdkafka_arginfo.h index 0e4fe52e..9cfb08de 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: ac271309a726a9656d3ede7e687a6635d037d966 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -126,11 +126,13 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_oauthbea ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_oauthbearerSetToken, 0, 0, 3) #endif ZEND_ARG_TYPE_INFO(0, token_value, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, lifetime_ms, IS_LONG, 0) + ZEND_ARG_TYPE_MASK(0, lifetime_ms, MAY_BE_LONG|MAY_BE_DOUBLE, NULL) ZEND_ARG_TYPE_INFO(0, principal_name, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extensions, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() +#endif +#if defined(HAS_RD_KAFKA_OAUTHBEARER) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_oauthbearerSetTokenFailure, 0, 1, IS_VOID, 0) #else @@ -161,19 +163,26 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Producer_initTransactions, 0, 0, 1) #endif ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0) ZEND_END_ARG_INFO() +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) #if (PHP_VERSION_ID >= 80100) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_RdKafka_Producer_beginTransaction, 0, 0, IS_VOID, 0) #else ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Producer_beginTransaction, 0, 0, 0) #endif ZEND_END_ARG_INFO() +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) #define arginfo_class_RdKafka_Producer_commitTransaction arginfo_class_RdKafka_Producer_initTransactions +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) #define arginfo_class_RdKafka_Producer_abortTransaction arginfo_class_RdKafka_Producer_initTransactions #endif + ZEND_METHOD(RdKafka, __construct); ZEND_METHOD(RdKafka, addBrokers); ZEND_METHOD(RdKafka, getMetadata); @@ -195,6 +204,8 @@ ZEND_METHOD(RdKafka, pausePartitions); ZEND_METHOD(RdKafka, resumePartitions); #if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_METHOD(RdKafka, oauthbearerSetToken); +#endif +#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_METHOD(RdKafka, oauthbearerSetTokenFailure); #endif ZEND_METHOD(RdKafka_Consumer, __construct); @@ -202,11 +213,18 @@ ZEND_METHOD(RdKafka_Consumer, newQueue); ZEND_METHOD(RdKafka_Producer, __construct); #if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, initTransactions); +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, beginTransaction); +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, commitTransaction); +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) 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) @@ -215,18 +233,10 @@ static const zend_function_entry class_RdKafka_methods[] = { 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) @@ -239,23 +249,38 @@ static const zend_function_entry class_RdKafka_methods[] = { 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) +#endif +#if defined(HAS_RD_KAFKA_OAUTHBEARER) 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) +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, beginTransaction, arginfo_class_RdKafka_Producer_beginTransaction, ZEND_ACC_PUBLIC) +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, commitTransaction, arginfo_class_RdKafka_Producer_commitTransaction, ZEND_ACC_PUBLIC) +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, abortTransaction, arginfo_class_RdKafka_Producer_abortTransaction, ZEND_ACC_PUBLIC) #endif ZEND_FE_END @@ -266,12 +291,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 +313,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 +324,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 +334,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 index 49f594b4..503de3bc 100644 --- a/rdkafka_legacy_arginfo.h +++ b/rdkafka_legacy_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ea957a110b42c19bcb4a244655c1eaf99a1e3961 */ + * Stub hash: ac271309a726a9656d3ede7e687a6635d037d966 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -78,7 +78,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_oauthbearerSetToken, 0, 0, 3) ZEND_ARG_INFO(0, principal_name) ZEND_ARG_INFO(0, extensions) ZEND_END_ARG_INFO() +#endif +#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_oauthbearerSetTokenFailure, 0, 0, 1) ZEND_ARG_INFO(0, error) ZEND_END_ARG_INFO() @@ -96,15 +98,22 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Producer_initTransactions, 0, 0, 1) ZEND_ARG_INFO(0, timeout_ms) ZEND_END_ARG_INFO() +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_Producer_beginTransaction, 0, 0, 0) ZEND_END_ARG_INFO() +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) #define arginfo_class_RdKafka_Producer_commitTransaction arginfo_class_RdKafka_Producer_initTransactions +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) #define arginfo_class_RdKafka_Producer_abortTransaction arginfo_class_RdKafka_Producer_initTransactions #endif + ZEND_METHOD(RdKafka, __construct); ZEND_METHOD(RdKafka, addBrokers); ZEND_METHOD(RdKafka, getMetadata); @@ -126,6 +135,8 @@ ZEND_METHOD(RdKafka, pausePartitions); ZEND_METHOD(RdKafka, resumePartitions); #if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_METHOD(RdKafka, oauthbearerSetToken); +#endif +#if defined(HAS_RD_KAFKA_OAUTHBEARER) ZEND_METHOD(RdKafka, oauthbearerSetTokenFailure); #endif ZEND_METHOD(RdKafka_Consumer, __construct); @@ -133,11 +144,18 @@ ZEND_METHOD(RdKafka_Consumer, newQueue); ZEND_METHOD(RdKafka_Producer, __construct); #if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, initTransactions); +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, beginTransaction); +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_METHOD(RdKafka_Producer, commitTransaction); +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) 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) @@ -146,18 +164,10 @@ static const zend_function_entry class_RdKafka_methods[] = { 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) @@ -170,23 +180,38 @@ static const zend_function_entry class_RdKafka_methods[] = { 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) +#endif +#if defined(HAS_RD_KAFKA_OAUTHBEARER) 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) +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, beginTransaction, arginfo_class_RdKafka_Producer_beginTransaction, ZEND_ACC_PUBLIC) +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, commitTransaction, arginfo_class_RdKafka_Producer_commitTransaction, ZEND_ACC_PUBLIC) +#endif +#if defined(HAS_RD_KAFKA_TRANSACTIONS) ZEND_ME(RdKafka_Producer, abortTransaction, arginfo_class_RdKafka_Producer_abortTransaction, ZEND_ACC_PUBLIC) #endif ZEND_FE_END @@ -197,23 +222,19 @@ 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_declare_typed_property(class_entry, property_error_cb_name, &property_error_cb_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_NONE(0)); 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_declare_typed_property(class_entry, property_dr_cb_name, &property_dr_cb_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_NONE(0)); zend_string_release(property_dr_cb_name); return class_entry; @@ -223,12 +244,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; } @@ -238,11 +255,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; } @@ -252,11 +265,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/tests/oauthbearer_integration.phpt b/tests/oauthbearer_integration.phpt index 1b9399cb..1b1882bf 100644 --- a/tests/oauthbearer_integration.phpt +++ b/tests/oauthbearer_integration.phpt @@ -64,7 +64,8 @@ try { $producer->getMetadata(false, $topic, 10*1000); echo "Metadata retrieved successfully when refresh callback set token\n"; } catch (\RdKafka\Exception $e) { - echo "FAIL: Caught exception when getting metadata after successfully refreshing any token\n"; + echo "FAIL: Caught exception when getting metadata after successfully refreshing any token:\n"; + printf("%s: %s\n", $e::class, $e->getMessage()); } // Test that refresh token with setting token failure will fail when getting metadata