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

From: Date: Thu, 28 Jan 2021 10:40:39 +0000
Subject: Bug #80678 [NEW]: json_decode fails on numbers with explizit "+" sign
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231805@lists.php.net to get a copy of this message
From: rainer-phpbugs at 7val dot com Operating system: all PHP version: 8.0.1 Package: JSON related Bug Type: Bug Bug description:json_decode fails on numbers with explizit "+" sign 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 bug report at https://bugs.php.net/bug.php?id=80678&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80678&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80678&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80678&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80678&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80678&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80678&r=support Expected behavior: https://bugs.php.net/fix.php?id=80678&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80678&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80678&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80678&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80678&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80678&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80678&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80678&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80678&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80678&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80678&r=mysqlcfg

« previous php.bugs (#231805) next »