WebPagetest Forums
json_response returns nothing - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Bugs/Issues (/forumdisplay.php?fid=10)
+--- Thread: json_response returns nothing (/showthread.php?tid=14138)



json_response returns nothing - matthew - 12-30-2015 08:18 AM

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


RE: json_response returns nothing - josephscott - 12-30-2015 04:16 PM

Is this for a private instance of WPT? If so, check your error logs.


RE: json_response returns nothing - matthew - 12-31-2015 01:14 AM

(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.


RE: json_response returns nothing - josephscott - 12-31-2015 03:03 AM

Some non-UTF8 items in there some where then? May be worth tracking down the source of that.


RE: json_response returns nothing - matthew - 12-31-2015 03:56 AM

(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