diff --git a/config.m4 b/config.m4 index 755fa986..17c9c32e 100644 --- a/config.m4 +++ b/config.m4 @@ -72,7 +72,11 @@ if test "$PHP_RDKAFKA" != "no"; then ]) 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]) ]) diff --git a/kafka_consumer.c b/kafka_consumer.c index a321ea33..d48abbd2 100644 --- a/kafka_consumer.c +++ b/kafka_consumer.c @@ -586,7 +586,7 @@ PHP_METHOD(RdKafka_KafkaConsumer, getMetadata) Returns the current ControllerId (controller broker id) as reported in broker metadata */ PHP_METHOD(RdKafka_KafkaConsumer, getControllerId) { - kafka_object *intern; + object_intern *intern; zend_long timeout; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timeout) == FAILURE) { diff --git a/tests/controller_id.phpt b/tests/controller_id.phpt index c6177bd1..d4cf5685 100644 --- a/tests/controller_id.phpt +++ b/tests/controller_id.phpt @@ -3,7 +3,7 @@ Display controller id --SKIPIF-- set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); -echo (new RdKafka\Producer($conf))->getControllerId(0) . \PHP_EOL; -echo (new RdKafka\Consumer($conf))->getControllerId(0) . \PHP_EOL; +echo (new RdKafka\Producer($conf))->getControllerId(10*1000) . \PHP_EOL; +echo (new RdKafka\Consumer($conf))->getControllerId(10*1000) . \PHP_EOL; $conf = new RdKafka\Conf(); $conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); $conf->set('group.id', 'test'); -echo (new RdKafka\KafkaConsumer($conf))->getControllerId(0) . \PHP_EOL; +echo (new RdKafka\KafkaConsumer($conf))->getControllerId(10*1000) . \PHP_EOL; --EXPECT-- -1 -1