FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » json testing suggestions
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
json testing suggestions [message #184541] Wed, 08 January 2014 01:33 Go to next message
r.mariotti is currently offline  r.mariotti
Messages: 17
Registered: December 2011
Karma: 0
Junior Member
Pls help jolt my old memory with this? Trying to work on some old php
progs that output using the json_encode function on a NEW install of
Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
using as the source for the json_encode it looks just fine. However,
firebug is showing non response.

I checked with phpinfo and it shows that I do have json installed and
active and when I try to run the target program I also receive just
errors.

So my question is: can someone recommend some ways to properly debug
the ajax/json process? I seem to remember firebug once having some
features available to examine the response from a js call but I don't
see it now.

BTW - having just recently upgraded from 10.04 to 13.10 I've run into
other issues with compatibiity. Hopefully they are getting resolved
and this is just one of them.

Thanks for any advice/suggestions.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Re: json testing suggestions [message #184542 is a reply to message #184541] Wed, 08 January 2014 02:48 Go to previous messageGo to next message
Richard Damon is currently offline  Richard Damon
Messages: 58
Registered: August 2011
Karma: 0
Member
On 1/7/14, 8:33 PM, BobMCT wrote:
> Pls help jolt my old memory with this? Trying to work on some old php
> progs that output using the json_encode function on a NEW install of
> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
> using as the source for the json_encode it looks just fine. However,
> firebug is showing non response.
>
> I checked with phpinfo and it shows that I do have json installed and
> active and when I try to run the target program I also receive just
> errors.
>
> So my question is: can someone recommend some ways to properly debug
> the ajax/json process? I seem to remember firebug once having some
> features available to examine the response from a js call but I don't
> see it now.
>
> BTW - having just recently upgraded from 10.04 to 13.10 I've run into
> other issues with compatibiity. Hopefully they are getting resolved
> and this is just one of them.
>
> Thanks for any advice/suggestions.
>

Have you checked the server logs to make sure the page being accessed
isn't generating a fatal PHP error and stopping the script?
Re: json testing suggestions [message #184543 is a reply to message #184541] Wed, 08 January 2014 04:23 Go to previous messageGo to next message
John Smith is currently offline  John Smith
Messages: 7
Registered: January 2014
Karma: 0
Junior Member
On Tue, 07 Jan 2014 20:33:21 -0500, BobMCT <r(dot)mariotti(at)fdcx(dot)net>
wrote:

> So my question is: can someone recommend some ways to properly debug
> the ajax/json process? I seem to remember firebug once having some
> Thanks for any advice/suggestions.
>
> ---
> This email is free from viruses and malware because avast! Antivirus protection is active.
> http://www.avast.com

Hi,

I still use json_encode like crazy, it works fantastic, no issues so
far;

You need to test two places
- On the php, ensure that you actually get something rendered. Are you
sure the php array or object is valid ? That is simple to test, put a
breakpoint there and run in debug, you figure out fast

- On the browser side, I assume you use some javascript framework,
jQuery or something. If you don't, please do it, it saves headache and
time. It is possible that the json crashes when it gets evaluated,
although if it is generated with json_encode this is less likely to
happen: locate you callback function and place a breakpoint in the
javascript code and see what comes.

Personally rather than leaving jQuery to eval my json, I prefer to
take the response as text and eval it myself - in between these two
likes of code, you can always alert(responsetext) and see what comes
back.

That always worked for me...
--
John
Re: json testing suggestions [message #184544 is a reply to message #184541] Wed, 08 January 2014 04:24 Go to previous messageGo to next message
John Smith is currently offline  John Smith
Messages: 7
Registered: January 2014
Karma: 0
Junior Member
> Thanks for any advice/suggestions.
>
> ---
> This email is free from viruses and malware because avast! Antivirus protection is active.
> http://www.avast.com


BTW, one thing - json_encode I don't believe that relies on an
external library, it was always there when I installed php;

--
John
Re: json testing suggestions [message #184545 is a reply to message #184541] Wed, 08 January 2014 06:39 Go to previous messageGo to next message
jnorth.au is currently offline  jnorth.au
Messages: 5
Registered: January 2014
Karma: 0
Junior Member
On Tue, 07 Jan 2014 20:33:21 -0500, BobMCT <r(dot)mariotti(at)fdcx(dot)net> wrote:

> Pls help jolt my old memory with this? Trying to work on some old php
> progs that output using the json_encode function on a NEW install of
> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
> using as the source for the json_encode it looks just fine. However,
> firebug is showing non response.

In php you should have the code looking like:

$myVar = json_encode( $arr );
echo $myVar;
?>

In firebug:
place a breakpoint at the first line of code in the callback function.
The returning data is actually the error message from php and can not processed correctly.

>
> I checked with phpinfo and it shows that I do have json installed and
> active and when I try to run the target program I also receive just
> errors.
>
> So my question is: can someone recommend some ways to properly debug
> the ajax/json process? I seem to remember firebug once having some
> features available to examine the response from a js call but I don't
> see it now.
>
> BTW - having just recently upgraded from 10.04 to 13.10 I've run into
> other issues with compatibiity. Hopefully they are getting resolved
> and this is just one of them.
>
> Thanks for any advice/suggestions.
>
> ---
> This email is free from viruses and malware because avast! Antivirus protection is active.
> http://www.avast.com

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Re: json testing suggestions [message #184546 is a reply to message #184545] Wed, 08 January 2014 12:32 Go to previous messageGo to next message
Beauregard T. Shagnas is currently offline  Beauregard T. Shagnas
Messages: 154
Registered: September 2010
Karma: 0
Senior Member
jnorth.au wrote:

>> ---
>> This email is free from viruses and malware because avast! Antivirus
>> protection is active.
>> http://www.avast.com
>
> ---
> This email is free from viruses and malware because avast! Antivirus
> protection is active.
> http://www.avast.com

jnorth.au, you and BobMCT both need to reconfigure your Avast programs to
remove the auto-insertion of the above spam messages. Thanks for your
consideration. It's caused by your recently updated version, and it also
has a malformed sig delimiter which causes it to be quoted by the unwary.

You do not need to scan outgoing or incoming email or news posts.
<http://thundercloud.net/infoave/tutorials/email-scanning/index.htm>

From the avastUI > Settings > Active Protection > Mail Shield > Settings
(wrench icon) > Behavior - General section > "Uncheck" Insert note into
clean message (outgoing).

--
-bts
-This space for rent, but the price is high
Re: json testing suggestions [message #184547 is a reply to message #184546] Wed, 08 January 2014 13:18 Go to previous messageGo to next message
r.mariotti is currently offline  r.mariotti
Messages: 17
Registered: December 2011
Karma: 0
Junior Member
On Wed, 8 Jan 2014 12:32:53 +0000 (UTC), "Beauregard T. Shagnasty"
<a(dot)nony(dot)mous(at)example(dot)invalid> wrote:

> jnorth.au wrote:
>
> You do not need to scan outgoing or incoming email or news posts.
> <http://thundercloud.net/infoave/tutorials/email-scanning/index.htm>
>
> From the avastUI > Settings > Active Protection > Mail Shield > Settings
> (wrench icon) > Behavior - General section > "Uncheck" Insert note into
> clean message (outgoing).

Thanks jnorth.au - done!
Re: json testing suggestions [message #184548 is a reply to message #184541] Wed, 08 January 2014 14:40 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
BobMCT wrote:

> Pls help jolt my old memory with this? Trying to work on some old php
> progs that output using the json_encode function on a NEW install of
> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
> using as the source for the json_encode it looks just fine. However,
> firebug is showing non response.

*Where* does it show “non response” (sic!)? *How?*

If in the Network tab, there are two possibilities:

A) You are not making an HTTP request with the correct URI.
B) You are not sending a non-empty HTTP response.

If A), you have to check the client-side script and Firebug's error console.
If B), you have to check the server-side script. Make sure that there are
no syntax errors or other PHP errors. The first lines of your PHP program
should be:

<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);

ini_set() is necessary (except on a development system where the value
should be the default) unless you want/have to check the PHP log files
instead.

> I checked with phpinfo and it shows that I do have json installed and
> active and when I try to run the target program I also receive just
> errors.

*Which* errors?

> So my question is: can someone recommend some ways to properly debug
> the ajax/json process?

In addition to the above, there is the FirePHP add-on.

> I seem to remember firebug once having some features available to examine
> the response from a js call but I don't see it now.

They still are in the Network tab and the Console. <http://getfirebug.com/>

> BTW - having just recently upgraded from 10.04 to 13.10

Of what?

> I've run into other issues with compatibiity.

Useless information again.

<http://www.catb.org/~esr/faqs/smart-questions.html#beprecise>

And please get a real name.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
Re: json testing suggestions [message #184549 is a reply to message #184541] Thu, 09 January 2014 08:38 Go to previous messageGo to next message
Gregor Kofler is currently offline  Gregor Kofler
Messages: 69
Registered: September 2010
Karma: 0
Member
Am 08.01.2014 02:33, BobMCT meinte:
> Pls help jolt my old memory with this? Trying to work on some old php
> progs that output using the json_encode function on a NEW install of
> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
> using as the source for the json_encode it looks just fine. However,
> firebug is showing non response.

Perhaps this:


< http://askubuntu.com/questions/361424/what-happened-to-json-encode-in-13-10 -php>

With PHP 5.5 on Ubuntu 13.10 php5-json has to be installed explicitly.

Gregor
Re: json testing suggestions [message #184550 is a reply to message #184549] Thu, 09 January 2014 12:38 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Gregor Kofler wrote:

> Am 08.01.2014 02:33, BobMCT meinte:
>> Pls help jolt my old memory with this? Trying to work on some old php
>> progs that output using the json_encode function on a NEW install of
>> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
>> using as the source for the json_encode it looks just fine. However,
>> firebug is showing non response.
>
> Perhaps this:
>
>
> < http://askubuntu.com/questions/361424/what-happened-to-json-encode-in-13-10 -php>
>
>
> With PHP 5.5 on Ubuntu 13.10 php5-json has to be installed explicitly.

Good catch! Regarding the explanation[1] that is linked from a comment:

| The response from PHP has been to remove the standard PHP JSON
| extension as of PHP 5.5rc2.

AFAIK, JSON has not been removed from PHP, but rather from some
distributions.

[1] <http://iteration99.com/2013/php-json-licensing-and-php-5-5/>

--
Christoph M. Becker
Re: json testing suggestions [message #184551 is a reply to message #184545] Thu, 09 January 2014 12:41 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 1/8/2014 1:39 AM, jnorth(dot)au(at)example(dot)com wrote:

> ?>
>
> In firebug:
> place a breakpoint at the first line of code in the callback function.

OT: in firebug, how does one set a breakpoint ?

bill
Re: json testing suggestions [message #184552 is a reply to message #184551] Thu, 09 January 2014 16:13 Go to previous messageGo to next message
John Smith is currently offline  John Smith
Messages: 7
Registered: January 2014
Karma: 0
Junior Member
On Thu, 09 Jan 2014 07:41:36 -0500, bill <william(at)TechServSys(dot)com>
wrote:

> On 1/8/2014 1:39 AM, jnorth(dot)au(at)example(dot)com wrote:
>
>> ?>
>>
>> In firebug:
>> place a breakpoint at the first line of code in the callback function.
>
> OT: in firebug, how does one set a breakpoint ?
>
> bill

you open the script in browser (start with right click - explore
element and from there go to the tab with the script, and set the
breakpoint.

Chrome is better in terms of debugging than Firefox with Firebug. Try
it.

For other questions please post in the right nntp group this is not
php


--

John
Re: json testing suggestions [message #184553 is a reply to message #184542] Fri, 10 January 2014 03:43 Go to previous message
r.mariotti is currently offline  r.mariotti
Messages: 17
Registered: December 2011
Karma: 0
Junior Member
On Tue, 07 Jan 2014 21:48:35 -0500, Richard Damon
<Richard(at)Damon-Family(dot)org> wrote:

> On 1/7/14, 8:33 PM, BobMCT wrote:
>> Pls help jolt my old memory with this? Trying to work on some old php
>> progs that output using the json_encode function on a NEW install of
>> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
>> using as the source for the json_encode it looks just fine. However,
>> firebug is showing non response.
>>
>> I checked with phpinfo and it shows that I do have json installed and
>> active and when I try to run the target program I also receive just
>> errors.
>>
>> So my question is: can someone recommend some ways to properly debug
>> the ajax/json process? I seem to remember firebug once having some
>> features available to examine the response from a js call but I don't
>> see it now.
>>
>> BTW - having just recently upgraded from 10.04 to 13.10 I've run into
>> other issues with compatibiity. Hopefully they are getting resolved
>> and this is just one of them.
>>
>> Thanks for any advice/suggestions.
>>
>
> Have you checked the server logs to make sure the page being accessed
> isn't generating a fatal PHP error and stopping the script?

Thanks for all the responses/suggestions. Being a newly installed
version of Ubuntu 13.10 Server I DID have to explicitly install the
php5-json package. Guess what? Now it works - gee.

And just one comment to "pointed ears" - get a life, huh!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Math Formula Question - Need Ideas
Next Topic: how did I wind up with double headers?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 17:27:36 GMT 2024

Total time taken to generate the page: 0.02756 seconds