Bug #80678 [PATCH]: json_decode fails on numbers with explizit "+" sign

From: Date: Thu, 28 Jan 2021 10:42:21 +0000
Subject: Bug #80678 [PATCH]: json_decode fails on numbers with explizit "+" sign
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231806@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80678&edit=1 ID: 80678 Patch added by: phpbugs@canavan.de Reported by: rainer-phpbugs at 7val dot com Summary: json_decode fails on numbers with explizit "+" sign Status: Open Type: Bug Package: JSON related Operating System: all PHP Version: 8.0.1 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: json_decode_positive_sign.patch Revision: 1611830541 URL: https://bugs.php.net/patch-display.php?bug=80678&patch=json_decode_positive_sign.patch&revision=1611830541 Previous Comments: ------------------------------------------------------------------------ [2021-01-28 10:40:39] rainer-phpbugs at 7val dot com Description: ------------ The JSON standard allows positive numbers to be represented with an explicit "+" sign, e.g. +123 (see the "sign" production on https://www.json.org/json-en.html). json_decode() fails and returns NULL for any JSON string that contains such a number. Also affects 7.3 and 7.4 branches. Test script: --------------- <?php $x=json_decode('+123.4'); var_export($x); print("\n"); $x=json_decode('123.4'); var_export($x); print("\n"); Expected result: ---------------- 123.4 123.4 Actual result: -------------- NULL 123.4 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80678&edit=1

« previous php.bugs (#231806) next »