diff --git a/kafka_consumer.c b/kafka_consumer.c index 5db8abc0..69126b5f 100644 --- a/kafka_consumer.c +++ b/kafka_consumer.c @@ -540,7 +540,7 @@ PHP_METHOD(RdKafka_KafkaConsumer, getControllerId) return; } - intern = get_kafka_object(getThis()); + intern = get_object(getThis()); if (!intern) { return; } diff --git a/tests/controller_id.phpt b/tests/controller_id.phpt index 19a14714..10ec2ddc 100644 --- a/tests/controller_id.phpt +++ b/tests/controller_id.phpt @@ -9,22 +9,16 @@ RD_KAFKA_BUILD_VERSION < 0x000b0500 && die("skip librdkafka < 0.11.5"); require __DIR__ . '/integration-tests-check.php'; $conf = new RdKafka\Conf(); -if (RD_KAFKA_VERSION >= 0x090000 && 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')); -$conf->setDrMsgCb(function ($rdkafka, $msg) { - var_dump($rdkafka, $msg); -}); +echo (new RdKafka\Producer($conf))->getControllerId(0) . \PHP_EOL; +echo (new RdKafka\Consumer($conf))->getControllerId(0) . \PHP_EOL; -$producer = new RdKafka\Producer($conf); -$consumer = new RdKafka\Consumer($conf); -$kafkaConsumer = new RdKafka\KafkaConsumer($conf); +$conf = new RdKafka\Conf(); +$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS')); +$conf->set('group.id', 'test'); -echo $producer->getControllerId() . \PHP_EOL; -echo $consumer->getControllerId() . \PHP_EOL; -echo $kafkaConsumer->getControllerId() . \PHP_EOL; +echo (new RdKafka\KafkaConsumer($conf))->getControllerId(0) . \PHP_EOL; --EXPECT-- 1 1