FB SDK produces a PHP Fatal error

后端 未结 3 1824
心在旅途
心在旅途 2021-01-17 05:33

First noticed [27-Mar-2017 17:47:16 GMT+0] a FB SDK integration that worked very well allowing people to login to our site via their Facebook account just stopped working. T

3条回答
  •  广开言路
    2021-01-17 06:32

    Suggested fix for line 191-193:

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

    You can also try converting $response to array but that won't be optimized solution. So, go ahead and try aforementioned solution.

    Or try replacing in src/Facebook/FacebookRedirectLoginHelper.php

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

    WITH

      $accessToken = null;
      if (is_object($response) && isset($response->access_token)) {
        $accessToken = $response->access_token;
      } elseif (is_array($response) && isset($response['access_token'])) {
        $accessToken = $response['access_token'];
      }
      if (isset($accessToken)) {
        return new FacebookSession($accessToken);
    

提交回复
热议问题