Edit report at https://bugs.php.net/bug.php?id=78332&edit=1
ID: 78332 Updated by: c...@php.net Reported by: fi at facelift-bbt dot com Summary: Int in JSON message formatted as string -Status: Feedback +Status: Open Type: Bug Package: PECL PHP Version: 7.2.20 Block user comment: N Private report: N New Comment: This is about https://pecl.php.net/package/rdkafka. Previous Comments: ------------------------------------------------------------------------ [2019-07-24 15:24:41] dan...@php.net Hi - the script you provided does not run, https://3v4l.org/XUMYj . It gives the error Fatal error: Uncaught Error: Class 'RdKafka\Producer' not found in /in/XUMYj:5 Running json_decode simply as you described it gives: https://3v4l.org/2VPX6 which appears to give an int. You might find reading this http://sscce.org/ helpful as a guide on how to write a self-contained reproduce case. ------------------------------------------------------------------------ [2019-07-24 14:14:54] fi at facelift-bbt dot com Test script: --------------- <?php $message = '{"id":1639}'; $producer = new RdKafka\Producer(); $topic = $producer->newTopic('myTopic'); $topic->produce(RD_KAFKA_PARTITION_UA, 0, $message); ?> ------------------------------------------------------------------------ [2019-07-24 13:54:32] requi...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2019-07-24 13:40:40] fi at facelift-bbt dot com Description: ------------ When producing an encoded JSON object that contains an integer field, the consumer always receives the field as string. Producer: {"id":1639} Consumer: {"id":"1639"} Test script: --------------- $message = '{"id":1639}'; $producer = new RdKafka\Producer(); $topic = $producer->newTopic('myTopic'); $topic->produce(RD_KAFKA_PARTITION_UA, 0, $message); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78332&edit=1 -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php