Edit report at https://bugs.php.net/bug.php?id=65499&edit=1
ID: 65499
User updated by: m dot kurzyna at crystalpoint dot pl
Reported by: m dot kurzyna at crystalpoint dot pl
Summary: json_decode reports invalid literal as valid JSON
Status: Open
Type: Bug
Package: JSON related
Operating System: Linux
PHP Version: 5.5.2
Block user comment: N
Private report: N
New Comment:
To be more precise - introduced regression casts the string to integer so
technically it takes all first digits just like (int)"123abc" would do.
Previous Comments:
------------------------------------------------------------------------
[2013-08-22 08:00:25] m dot kurzyna at crystalpoint dot pl
Description:
------------
There is a regression in json_decode starting with PHP5.5 (5.4.x works as
expected).
json_decode() now treats literals staring with an integer as valid JSON
consisting only of the first character.
Test script:
---------------
<?php
var_dump(
json_decode("9af5"),
json_last_error()
);
Expected result:
----------------
NULL
int(4)
Actual result:
--------------
int(9)
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65499&edit=1