arnaud-lb / php-rdkafka

Production-ready, stable Kafka client for PHP
MIT License
2.08k stars 263 forks source link

v6 Conf/TopicConf types problem #501

Closed b1rdex closed 2 years ago

b1rdex commented 2 years ago

Description

The following code:

<?php
$rdKafkaTopicConfig = new \RdKafka\TopicConf();
$producerTopic = $this->producerConfig->getTopicConfig($envelope);
foreach ($producerTopic->getParams() as $name => $value) {
    $rdKafkaTopicConfig->set($name, $value);
}
$topic = $producer->newTopic($producerTopic->getName(), $rdKafkaTopicConfig);

But I expected this output instead:

 Argument #2 ($topic_conf) must be of type ?RdKafka\Conf, RdKafka\TopicConf given

php-rdkafka Version

6.0.0RC2

librdkafka Version

1.6.0

PHP Version

8.0

Operating System

debian 11 / alpine

Kafka Version

No response

b1rdex commented 2 years ago

v5 code works fine, v6 = fatal error. IMO the type is incorrect and should be reverted.

b1rdex commented 2 years ago

Here is a snippet from the readme: image

Looks like a test for this part is missing?

b1rdex commented 2 years ago

https://github.com/arnaud-lb/php-rdkafka/blob/c4260fb5354460cb1d96671607f50c2f23753054/rdkafka.stub.php#L40

https://github.com/arnaud-lb/php-rdkafka/blob/c4260fb5354460cb1d96671607f50c2f23753054/kafka_consumer.stub.php#L52

arnaud-lb commented 2 years ago

Thank you @b1rdex

Fixed in #502