Home > facebook > Php Facebook client library bug

Php Facebook client library bug

January 16th, 2009

I setup this blog just a few hours ago and thought, even if I do have a few things I want to share here, I would have written my first post not before next week. I was wrong :)

For some reasons I might tell you later on (I mean in a month or so), I am working with the Facebook php platform in order to develop my first Facebook app.

I downloaded the Php Client library, carefully read tons and tons of documentation and then started coding. Actually I had to set up my application in Facebook Developers first, but let’s skip this step.

I am going to develop a Desktop Application and the first thing I am supposed to implement is the Login of the Facebook user in the application, as explained here: http://www.facebook.com/developers/apps.php?app_id=55288994973&ret=2.

I spent many hours var-dumping results of the api calls and always obtained empty strings, which was a little bit odd (but above all, quite upsetting :-)). I thought I was doing something wrong, either with the code or server settings. Nope. I was about to jump into something else when I thought about checking how the FacebookRestClient class wrapped all the call to the REST server, and found a bug.

If your server does not support the Php Client URL Library, the call is handled by the run_http_post_transaction internal method (facebookapi_php5_restlib.php file, FacebookRestClient class, post_request method, line 2613):

$this->run_http_post_transaction($content_type, $content);

As you can see, the value returned by the run_http_post_transaction method is not assigned to any variable but the post_request method does return a variable, called $result.

public function post_request($method, $params) {
[...]
return $result;
}

A very easy to fix bug, just replace line 2613 with the following:

$result = $this->run_http_post_transaction($content_type, $content);

Ahhh now I can go on coding my app… Nope, I’m tired… I’d better play some Biotronic ;-)

devu facebook , , , ,

  1. No comments yet.
  1. No trackbacks yet.