Bug #67502 [Fbk]: json_decode accepts wrong strings without syntax error and still decodes
| From: | aharvey@php.net | Date: | Mon, 23 Jun 2014 22:04:02 +0000 |
| Subject: | Bug #67502 [Fbk]: json_decode accepts wrong strings without syntax error and still decodes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186310@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67502&edit=1
ID: 67502
Updated by: aharvey@php.net
Reported by: nevil85 at gmail dot com
Summary: json_decode accepts wrong strings without syntax
error and still decodes
Status: Feedback
Type: Bug
Package: JSON related
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
How did you get PHP in the first place â did you compile it from source, or are you using
packages? If the latter, which distribution are you on?
I'm wondering if this is an issue with one of the distros that are replacing ext/json for
licensing reasons.
Previous Comments:
------------------------------------------------------------------------
[2014-06-23 17:30:56] requinix@php.net
Works for me.
http://3v4l.org/HuGvq
------------------------------------------------------------------------
[2014-06-23 13:29:44] nevil85 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.json-decode
---
json_decode accepts wrong strings without syntax error and still decodes
<?php
echo json_decode("2014-06-06");
echo json_last_error();
?>
The above code snippet returns 20140. It is a bug, as the error code is 0.
Test script:
---------------
<?php
echo json_decode("2014-06-06");
echo json_last_error();
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67502&edit=1