Skip Menu |

This queue is for tickets about the WWW-Facebook-API CPAN distribution.

Report information
The Basics
Id: 27763
Status: resolved
Priority: 0/
Queue: WWW-Facebook-API

People
Owner: Nobody in particular
Requestors: jspath [...] pangeamedia.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: v0.3.4
Fixed in: (no value)



Subject: Problem with parse(), JSON::XS, and notifications->send()
I have parse set to 1 and am using JSON (JSON::XS) to parse responses. I'm using perl 5.8.7, JSON::XS version 1.3, and Ubuntu 6.06 LTS When I call $facebook->notifications->send(), the notifications are sent, but the application chokes on the response, which appears to be blank. The error that I get is: JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this) at /usr/share/perl5/JSON/Any.pm line 318. When I turn debug on, I see the following: params = api_key:XXXXXXXXXXXXXXXXX format:JSON markup:test method:facebook.notifications.send no_email:1 secret:XXXXXXXXXXXXXXXXX session_key:XXXXXXXXXXXXXXXXX sig:XXXXXXXXXXXXXXXXX to_ids:XXXXXXXXXXXXXXXXX v:1.0 response = "" at /usr/share/perl5/WWW/Facebook/API/Notifications.pm line 29 JSON::Any is using JSON::XS to parse "" at /usr/share/perl5/WWW/Facebook/API/Notifications.pm line 29 If I force JSON::Any to use the JSON library to parse, I do not get this error. While this is most likely indicative of a problem with JSON::XS or JSON::Any, or the combination of the two, I thought I would report this here first. Please let me know if I should direct this bug report elsewhere.
Subject: Re: [rt.cpan.org #27763] Problem with parse(), JSON::XS, and notifications->send()
Date: Tue, 26 Jun 2007 17:24:24 -0700
To: Jim Spath via RT <bug-WWW-Facebook-API [...] rt.cpan.org>
From: David Romano <unobe [...] cpan.org>
Hi Jim, Jim Spath via RT wrote on Tue, Jun 26, 2007 at 03:41:28PM PDT: Show quoted text
> I have parse set to 1 and am using JSON (JSON::XS) to parse responses. > I'm using perl 5.8.7, JSON::XS version 1.3, and Ubuntu 6.06 LTS > > When I call $facebook->notifications->send(), the notifications are > sent, but the application chokes on the response, which appears to be blank. > > The error that I get is: > > JSON text must be an object or array (but found number, string, true, > false or null, use allow_nonref to allow this) at > /usr/share/perl5/JSON/Any.pm line 318. > ... > If I force JSON::Any to use the JSON library to parse, I do not get this > error. > > While this is most likely indicative of a problem with JSON::XS or > JSON::Any, or the combination of the two, I thought I would report this > here first. Please let me know if I should direct this bug report > elsewhere.
Thanks for the bug report! Matt Sickler noticed this too, and now I'm thinking it's a JSON::XS problem. I've attached a patch to try to work around the problem. Can you see if it does the trick? - David -- "Mankind have a great aversion to intellectual labor; but even supposing knowledge to be easily attainable, more people would be content to be ignorant than would take even a little trouble to acquire it." -- Samuel Johnson
Subject: Re: [rt.cpan.org #27763] Problem with parse(), JSON::XS, and notifications->send()
Date: Tue, 26 Jun 2007 17:31:12 -0700
To: Jim Spath via RT <bug-WWW-Facebook-API [...] rt.cpan.org>
From: David Romano <unobe [...] cpan.org>
unobe@cpan.org via RT wrote on Tue, Jun 26, 2007 at 05:24:56PM PDT: Show quoted text
> Thanks for the bug report! Matt Sickler noticed this too, and now I'm > thinking it's a JSON::XS problem. I've attached a patch to try to work > around the problem. Can you see if it does the trick?
Forgot to attach the patch :-/ - David -- "Study without desire spoils the memory, and it retains nothing that it takes in." -- Leonardo da Vinci

Message body is not shown because sender requested not to inline it.

From: GAAS [...] cpan.org
I see the same problem here when I try to call $facebook->profile->set_fbml(markup => "..."). The error message I get is: JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this) at /opt/perl/ap820/site/lib/JSON/Any.pm line 318. Turning on debug I see that the reponse is simply "true"; which isn't really legal JSON.
Subject: Re: [rt.cpan.org #27763] Problem with parse(), JSON::XS, and notifications->send()
Date: Thu, 28 Jun 2007 13:25:05 -0700
To: Gisle_Aas via RT <bug-WWW-Facebook-API [...] rt.cpan.org>
From: David Romano <david.romano [...] gmail.com>
Gisle_Aas via RT wrote on Thu, Jun 28, 2007 at 01:13:53PM PDT: Show quoted text
> I see the same problem here when I try to call > $facebook->profile->set_fbml(markup => "..."). The error message I get is: > > JSON text must be an object or array (but found number, string, true, > false or null, use allow_nonref to allow this) at > /opt/perl/ap820/site/lib/JSON/Any.pm line 318. > > Turning on debug I see that the reponse is simply "true"; which isn't > really legal JSON.
Thanks Gisle! So that means Facebook is returning invalid JSON, and it's not JSON::XS's problem. I have just uploaded v0.3.5 to CPAN which should fix this problem. I patched it a just a bit differently than the patch I supplied previously (I forgot about the beginning and end quotes). I have attached another patch for v0.3.4 to this e-mail. - David -- "Few men have virtue to withstand the highest bidder." -- George Washington

Message body is not shown because sender requested not to inline it.

v0.3.6