diff --git a/kafka_consumer.c b/kafka_consumer.c index d48abbd..2c0eddb 100644 --- a/kafka_consumer.c +++ b/kafka_consumer.c @@ -767,7 +767,7 @@ PHP_METHOD(RdKafka_KafkaConsumer, queryWatermarkOffsets) object_intern *intern; char *topic; size_t topic_length; - long low, high; + int64_t low, high; zend_long partition, timeout; zval *lowResult, *highResult; rd_kafka_resp_err_t err; @@ -791,8 +791,8 @@ PHP_METHOD(RdKafka_KafkaConsumer, queryWatermarkOffsets) return; } - ZVAL_LONG(lowResult, low); - ZVAL_LONG(highResult, high); + ZVAL_LONG(lowResult, (zend_long) low); + ZVAL_LONG(highResult, (zend_long) high); } /* }}} */ diff --git a/rdkafka.c b/rdkafka.c index 727fc8c..783de1b 100644 --- a/rdkafka.c +++ b/rdkafka.c @@ -721,7 +721,7 @@ PHP_METHOD(RdKafka, queryWatermarkOffsets) kafka_object *intern; char *topic; size_t topic_length; - long low, high; + int64_t low, high; zend_long partition, timeout; zval *lowResult, *highResult; rd_kafka_resp_err_t err; @@ -745,8 +745,8 @@ PHP_METHOD(RdKafka, queryWatermarkOffsets) return; } - ZVAL_LONG(lowResult, low); - ZVAL_LONG(highResult, high); + ZVAL_LONG(lowResult, (zend_long) low); + ZVAL_LONG(highResult, (zend_long) high); } /* }}} */ diff --git a/tests/bug508.phpt b/tests/bug508.phpt index c36d994..d4f24ff 100644 --- a/tests/bug508.phpt +++ b/tests/bug508.phpt @@ -73,7 +73,7 @@ array(10) { ["topic_name"]=> string(%d) "test_rdkafka_%s" ["timestamp"]=> - int(%d) + int(%f) ["partition"]=> int(0) ["payload"]=> diff --git a/topic.c b/topic.c index f1c0f7f..d3a9f6b 100644 --- a/topic.c +++ b/topic.c @@ -128,7 +128,7 @@ PHP_METHOD(RdKafka_ConsumerTopic, consumeCallback) } if (partition < 0 || partition > 0x7FFFFFFF) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -165,7 +165,7 @@ PHP_METHOD(RdKafka_ConsumerTopic, consumeQueueStart) } if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -223,7 +223,7 @@ PHP_METHOD(RdKafka_ConsumerTopic, consumeStart) } if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -275,7 +275,7 @@ PHP_METHOD(RdKafka_ConsumerTopic, consumeStop) } if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -316,7 +316,7 @@ PHP_METHOD(RdKafka_ConsumerTopic, consume) } if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -357,12 +357,12 @@ PHP_METHOD(RdKafka_ConsumerTopic, consumeBatch) } if (0 >= batch_size) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for batch_size", batch_size); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for batch_size", batch_size); return; } if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -406,7 +406,7 @@ PHP_METHOD(RdKafka_ConsumerTopic, offsetStore) } if (partition < 0 || partition > 0x7FFFFFFF) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } @@ -455,12 +455,12 @@ PHP_METHOD(RdKafka_ProducerTopic, produce) ZEND_PARSE_PARAMETERS_END(); if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } if (msgflags != 0 && msgflags != RD_KAFKA_MSG_F_BLOCK) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid value '%ld' for $msgflags", msgflags); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid value '" ZEND_LONG_FMT "' for $msgflags", msgflags); return; } @@ -524,12 +524,12 @@ PHP_METHOD(RdKafka_ProducerTopic, producev) ZEND_PARSE_PARAMETERS_END(); if (partition != RD_KAFKA_PARTITION_UA && (partition < 0 || partition > 0x7FFFFFFF)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '%ld' for $partition", partition); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Out of range value '" ZEND_LONG_FMT "' for $partition", partition); return; } if (msgflags != 0 && msgflags != RD_KAFKA_MSG_F_BLOCK) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid value '%ld' for $msgflags", msgflags); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Invalid value '" ZEND_LONG_FMT "' for $msgflags", msgflags); return; }