Categories
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);
}
Share this...

By WebKraft Studios

WebKraft Studios are a creative agency specialising in web design and development founded by Gavin Potts.

Leave a Reply

Your email address will not be published.