Bug #67502 [Nab]: json_decode accepts wrong strings without syntax error and still decodes
| From: | tyrael@php.net | Date: | Wed, 25 Jun 2014 18:21:10 +0000 |
| Subject: | Bug #67502 [Nab]: 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-186345@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: tyrael@php.net
Reported by: nevil85 at gmail dot com
Summary: json_decode accepts wrong strings without syntax
error and still decodes
Status: Not a bug
Type: Bug
Package: JSON related
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
I will poke Remi about it.
Previous Comments:
------------------------------------------------------------------------
[2014-06-25 17:11:00] aharvey@php.net
Closing not a bug; you'll need to report this to the relevant Ubuntu developers at https://bugs.launchpad.net/ubuntu/+source/php-json.
------------------------------------------------------------------------
[2014-06-25 14:53:30] nevil85 at gmail dot com
You are correct. The bug is available only in a PHP distro, that came with Ubuntu 14 LTS OS.
Version:
PHP Version 5.5.9-1ubuntu4
System:
Linux <user> 3.13.0-29-generic #53-Ubuntu SMP <time> x86_64
Build Date:
Apr 9 2014 17:08:00
Thanks guys. I really appreciate.
------------------------------------------------------------------------
[2014-06-23 22:04:02] aharvey@php.net
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.
------------------------------------------------------------------------
[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