Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Dec 18, 2016
1 parent 7bdf772 commit fac6817
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kafka_consumer.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ static void consumer_commit(int async, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
rd_kafka_topic_partition_list_t *offsets = NULL;
rd_kafka_resp_err_t err;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &zarg) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!", &zarg) == FAILURE) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions rdkafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ PHP_METHOD(RdKafka__Consumer, __construct)

zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O", &zconf, ce_kafka_conf) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!", &zconf, ce_kafka_conf) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
Expand Down Expand Up @@ -423,7 +423,7 @@ PHP_METHOD(RdKafka__Kafka, newTopic)
rd_kafka_topic_conf_t *conf = NULL;
kafka_conf_object *conf_intern;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|O", &topic, &topic_len, &zconf, ce_kafka_topic_conf) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|O!", &topic, &topic_len, &zconf, ce_kafka_topic_conf) == FAILURE) {
return;
}

Expand Down Expand Up @@ -591,7 +591,7 @@ PHP_METHOD(RdKafka__Producer, __construct)

zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O", &zconf, ce_kafka_conf) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!", &zconf, ce_kafka_conf) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
Expand Down
14 changes: 14 additions & 0 deletions tests/bug74.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
Bug 74
--FILE--
<?php

$consumer = new RdKafka\Consumer(null);
$topic = $consumer->newTopic("batman", null);

$producer = new RdKafka\Producer(null);

if (class_exists('RdKafka\TopicPartition')) {
$tp = new RdKafka\TopicPartition("batman", 0, null);
}
--EXPECT--
2 changes: 1 addition & 1 deletion topic.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ PHP_METHOD(RdKafka__ProducerTopic, produce)
rd_kafka_resp_err_t err;
kafka_topic_object *intern;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls|s", &partition, &msgflags, &payload, &payload_len, &key, &key_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls|s!", &partition, &msgflags, &payload, &payload_len, &key, &key_len) == FAILURE) {
return;
}

Expand Down

0 comments on commit fac6817

Please sign in to comment.