Bug #78332 [Opn->Fbk]: Int in JSON message formatted as string
| From: | cmb@php.net | Date: | Mon, 07 Dec 2020 12:33:33 +0000 |
| Subject: | Bug #78332 [Opn->Fbk]: Int in JSON message formatted as string | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-17099@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78332&edit=1
ID: 78332
Updated by: cmb@php.net
Reported by: fi at facelift-bbt dot com
Summary: Int in JSON message formatted as string
-Status: Open
+Status: Feedback
Type: Bug
Package: PECL
PHP Version: 7.2.20
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Is this still an issue with latest rdkafka and any of the actively
supported PHP versions[1]? If so, you may be better off to report
that as issue on the Github repo[2].
[1] <https://www.php.net/supported-versions.php>
[2] <https://github.com/arnaud-lb/php-rdkafka>
Previous Comments:
------------------------------------------------------------------------
[2019-07-25 06:43:27] fi at facelift-bbt dot com
Serializing and deserializing in PHP works well, yes.
But after processing the serialized JSON object with the Kafka producer and reading the message in a
consumer written in Java, the int field has been transformed into a string - before deserializing.
------------------------------------------------------------------------
[2019-07-24 15:58:12] cmb@php.net
This is about https://pecl.php.net/package/rdkafka.
------------------------------------------------------------------------
[2019-07-24 15:24:41] danack@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] requinix@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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=78332
--
Edit this bug report at https://bugs.php.net/bug.php?id=78332&edit=1