Bug #67502 [Opn->Fbk]: json_decode accepts wrong strings without syntax error and still decodes
| From: | requinix@php.net | Date: | Mon, 23 Jun 2014 17:30:56 +0000 |
| Subject: | Bug #67502 [Opn->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-186307@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: requinix@php.net
Reported by: nevil85 at gmail dot com
Summary: json_decode accepts wrong strings without syntax
error and still decodes
-Status: Open
+Status: Feedback
Type: Bug
Package: JSON related
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
Works for me.
http://3v4l.org/HuGvq
Previous Comments:
------------------------------------------------------------------------
[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