Bug #67502 [Fbk->Opn]: json_decode accepts wrong strings without syntax error and still decodes
| From: | nevil85 at gmail dot com | Date: | Wed, 25 Jun 2014 14:53:30 +0000 |
| Subject: | Bug #67502 [Fbk->Opn]: 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-186340@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
User updated by: nevil85 at gmail dot com
Reported by: nevil85 at gmail dot com
Summary: json_decode accepts wrong strings without syntax
error and still decodes
-Status: Feedback
+Status: Open
Type: Bug
Package: JSON related
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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