Bug #81102 [Csd->Nab]: json integer is converted to string

From: Date: Thu, 03 Jun 2021 17:52:00 +0000
Subject: Bug #81102 [Csd->Nab]: json integer is converted to string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234195@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81102&edit=1 ID: 81102 Updated by: cmb@php.net Reported by: kumar dot muthaiah at yahoo dot com Summary: json integer is converted to string -Status: Closed +Status: Not a bug Type: Bug Package: JSON related Operating System: linux PHP Version: 7.4Git-2021-06-03 (Git) Assigned To: cmb Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2021-06-03 17:51:54] cmb@php.net Well, then this is obviously not a PHP bug. ------------------------------------------------------------------------ [2021-06-03 17:39:09] kumar dot muthaiah at yahoo dot com The problem is wordpress REST API which converts json integers to strings.PHP is doing fine. i've modified the known parameters by converting to respective types before sending to json_encode(). working fine. ------------------------------------------------------------------------ [2021-06-03 17:18:52] cmb@php.net > After conversion i get I get a syntax error even before conversion. ------------------------------------------------------------------------ [2021-06-03 16:49:59] kumar dot muthaiah at yahoo dot com Description: ------------ json integer is converted to string in wordpress php 7.4 version for json_encode() function. Causes javascript in client side to not load the component that depends on json. I'm using Wordopress REST API. Test script: --------------- $p = {"id:": 1, "object": {"name": "kumar", "age": 10, "married": false}}; json_encode($p['object']); After conversion i get {"name": "kumar", "age": "10", "married": "false"} Actual result: -------------- {"name": "kumar", "age": 10, "married": false} ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81102&edit=1

« previous php.bugs (#234195) next »