Bug #67502 [NEW]: json_decode accepts wrong strings without syntax error and still decodes
| From: | nevil85 at gmail dot com | Date: | Mon, 23 Jun 2014 13:29:44 +0000 |
| Subject: | Bug #67502 [NEW]: json_decode accepts wrong strings without syntax error and still decodes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186303@lists.php.net to get a copy of this message | ||
From: nevil85 at gmail dot com
Operating system:
PHP version: 5.5.13
Package: JSON related
Bug Type: Bug
Bug description:json_decode accepts wrong strings without syntax error and still decodes
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 bug report at https://bugs.php.net/bug.php?id=67502&edit=1
--