[ZBX-11244] json parsing fails with "Invalid JSON" Created: 2016 Sep 20  Updated: 2017 May 30  Resolved: 2016 Oct 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 3.0.4
Fix Version/s: 3.0.6rc1, 3.2.2rc1, 3.4.0alpha1

Type: Incident report Priority: Blocker
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: json, regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-11254 incorrect error message "JSON-rpc ver... Closed

 Comments   
Comment by richlv [ 2016 Sep 20 ]

looks like json parsing got seriously broken in ZBX-10880.

$ json='{"jsonrpc":"2.0","method":"user.login","params":{"user":"Admin","password":"zabbix"},"id":1}'
$ curl -w '\n' -s -X POST -H 'Content-Type: application/json-rpc' -d "$json" http://localhost/3.0/api_jsonrpc.php
{"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error","data":"Invalid JSON. An error occurred on the server while parsing the JSON text."},"id":null}

curl sends :

"POST /zabbix/api_jsonrpc.php HTTP/1.1\r\nHost: localhost\r\nUser-Agent: curl/7.42.1\r\nAccept: */*\r\nContent-Type: application/json-rpc\r\nContent-Length: 92\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"user.login\",\"params\":{\"user\":\"Admin\",\"password\":\"zabbix\"},\"id\":1}"
Comment by richlv [ 2016 Sep 20 ]

for the record, php 5.4.20

vitalijs.cemeris Could not reproduce with PHP 5.4.20 and PHP 5.6.23.

Comment by vitalijs.cemeris (Inactive) [ 2016 Sep 21 ]

This issue is reproducible when PHP is compiled without JSON library.

Comment by richlv [ 2016 Sep 28 ]

more users are hit by this : ZBX-11274

Comment by Ivo Kurzemnieks [ 2016 Oct 12 ]

(1) Moved ZBX-11254 to here.

vitalijs.cemeris Issue described in ZBX-11254 was fixed in Zabbix 3.0.4 under ZBX-10880.

iivs em ... yeah, but the only problem was that both valid and invalid json strings returned same error.

vitalijs.cemeris RESOLVED in r63256
Fixed incorrect error message when received JSON is not a valid JSON-RPC Request.

iivs CLOSED

Comment by richlv [ 2016 Oct 14 ]

(2) [D] given that this has slipped in two released versions already, i'd suggest to document in the known issues section that 3.0.4 and 3.0.5 break api unless a non-requirement module is installed. hoping that 3.0.6 will be good

vitalijs.cemeris I agree that this should be documented.
Known issues:

  • API fails decoding valid JSON-RPC request: 3.0, 3.2

RESOLVED

martins-v Looks good enough to me.

iivs CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Oct 18 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-11244

Comment by vitalijs.cemeris (Inactive) [ 2016 Oct 18 ]

(3) No translation strings changed.

iivs CLOSED

Comment by Ivo Kurzemnieks [ 2016 Oct 26 ]

TESTED

Comment by vitalijs.cemeris (Inactive) [ 2016 Oct 27 ]

Fixed in:

  • pre-3.0.6rc1 r63368
  • pre-3.2.2rc1 r63372
  • pre-3.3.0 r63369
Comment by vitalijs.cemeris (Inactive) [ 2016 Oct 27 ]

(4) [D] Zabbix API changes "fixed decoding valid JSON-RPC request when PHP is compiled without JSON library" in: 3.0, 3.2

martins-v Reviewed, with one small grammar fix.

iivs CLOSED

Generated at Fri Mar 29 00:23:07 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.