php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67923 json_decode doesn't give error when decoding IP address
Submitted: 2014-08-28 11:08 UTC Modified: 2014-12-17 17:30 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sorin dot badea91 at gmail dot com Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.5.16 OS: Elementary OS 0.2.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sorin dot badea91 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-08-28 11:08 UTC] sorin dot badea91 at gmail dot com
Description:
------------
php -v                                                                                                                                                                                              
PHP 5.5.16-1+deb.sury.org~precise+1 (cli) (built: Aug 25 2014 10:23:41) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with XCache v4.0.0-dev, Copyright (c) 2005-2013, by mOo
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with XCache Optimizer v4.0.0-dev, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v4.0.0-dev, Copyright (c) 2005-2013, by mOo
    with XCache Coverager v4.0.0-dev, Copyright (c) 2005-2013, by mOo



Test script:
---------------
<?php
var_dump(json_decode("192.168.1.1")); //=>float(192.168)
var_dump(json_last_error());//=>int(0)

Expected result:
----------------
An error


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-17 17:30 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-12-17 17:30 UTC] nikic@php.net
Working fine: http://3v4l.org/dkcl5

You're likely using jsonc instead of json.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC