Bug #81102 [Com]: json integer is converted to string

From: Date: Thu, 03 Jun 2021 17:39:09 +0000
Subject: Bug #81102 [Com]: json integer is converted to string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234193@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 Comment by: kumar dot muthaiah at yahoo dot com Reported by: kumar dot muthaiah at yahoo dot com Summary: json integer is converted to string Status: Open Type: Bug Package: *General Issues Operating System: linux PHP Version: 7.4Git-2021-06-03 (Git) Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#234193) next »