Coding

How to Fix Facebook PHP SDK Error When Updating

A recent update to the Facebook SDK has caused issues with some older versions which causes the following error:

PHP Fatal error: Cannot use object of type stdClass as array in FacebookRedirectLoginHelper.php on line 191

To fix this issue, go to FacebookRedirectLoginHelper.php then find $response['access_token']

You will see this code:

if (isset($response['access_token'])) {
    return new FacebookSession($response['access_token']);
}

Replace it with this:

if (isset($response->access_token)) {
    return new FacebookSession($response->access_token);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Got a project in mind?

Let us make something together.

A new website, a makeover for an old one, a brand or a game site. Tell us about it and we will get back to you.