json_response returns nothing
|
12-30-2015, 08:18 AM
Post: #1
|
|||
|
|||
json_response returns nothing
Hi,
I just find sometimes jsonResult.php can't return json result correctly, but nothing.(html and xml results work perfectly) For example: The path is jsonResult.php?test=151229_ZR_Z4 in jsonResult.php file, I can see: json_response($ret); I var_dump($ret) and get a large array, but json_response($ret) returns nothing. I guess it's because the size of my array is too big, and json_encode can't accept the large array. Maybe it's a bug, is there a quick solution to solve it? Thanks |
|||
12-30-2015, 04:16 PM
Post: #2
|
|||
|
|||
RE: json_response returns nothing
Is this for a private instance of WPT? If so, check your error logs.
|
|||
12-31-2015, 01:14 AM
(This post was last modified: 12-31-2015 01:39 AM by matthew.)
Post: #3
|
|||
|
|||
RE: json_response returns nothing
(12-30-2015 04:16 PM)josephscott Wrote: Is this for a private instance of WPT? If so, check your error logs. Hi, thanks for reply. yes, it's a private instance. it's a good idea. but there is nothing in the error log. I added json_last_error() in the jsonResult.php, and got the output is 5, which is JSON_ERROR_UTF8 After I utf8_encode the array, json_response finally output the json. |
|||
12-31-2015, 03:03 AM
Post: #4
|
|||
|
|||
RE: json_response returns nothing
Some non-UTF8 items in there some where then? May be worth tracking down the source of that.
|
|||
12-31-2015, 03:56 AM
Post: #5
|
|||
|
|||
RE: json_response returns nothing
(12-31-2015 03:03 AM)josephscott Wrote: Some non-UTF8 items in there some where then? May be worth tracking down the source of that. oh, sorry, I forget to add some words at the first: json_response doesn't always return nothing, just seldom. At beginning, I thought there are some special characters in the array items. But, I use mb_detect_encoding and find almost all the items in the array are in ASCII for example: 151227_DE_CB 1500 Sun, 27 Dec 2015 07:33:00 +0000 all of them are in ASCII |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)