php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72574 Non encoded string with IP-address recognized as float by json_decode
Submitted: 2016-07-11 09:27 UTC Modified: 2016-07-12 09:33 UTC
From: apuzanoff at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: JSON related
PHP Version: 5.6.23 OS: deb8u1
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: apuzanoff at gmail dot com
New email:
PHP Version: OS:

 

 [2016-07-11 09:27 UTC] apuzanoff at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.json-decode
---

non encoded string with IP-address recognized as float

Test script:
---------------
echo json_decode('10.7.11.122'), '<br>';

Expected result:
----------------
empty string with generate error

Actual result:
--------------
10.7

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-11 09:31 UTC] apuzanoff at gmail dot com
P.S. It works on windows php as expected. Empty string and JSON_ERROR_SYNTAX from json_last_error()
 [2016-07-11 12:05 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-07-11 12:05 UTC] cmb@php.net
I can't reproduce with ext/json, see <https://3v4l.org/3lTDq>.
However, Debian ships with json-c by default; which libjson do you
use?
 [2016-07-12 05:43 UTC] apuzanoff at gmail dot com
-Status: Feedback +Status: Assigned
 [2016-07-12 05:43 UTC] apuzanoff at gmail dot com
json support => enabled
json version => 1.3.6
JSON-C headers version => 0.11.99
JSON-C library version => 0.11.99
 [2016-07-12 09:27 UTC] nikic@php.net
-Status: Assigned +Status: Not a bug
 [2016-07-12 09:27 UTC] nikic@php.net
JSON-C is an external JSON extension which we do not maintain. From a quick look at the pecl-json-c repo, the issue is already fixed there: https://github.com/remicollet/pecl-json-c/commit/c24fdc695810f16f57f6ca1b4dda11f7a8b74310 Maybe you can convince Debian to update their version.
 [2016-07-12 09:33 UTC] cmb@php.net
Thanks.

I have filed a respective ticket in the json-c tracker
(<https://github.com/remicollet/pecl-json-c/issues/29>), and close
this report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 17:01:29 2024 UTC