I use Facebook PHP SDK (v.3.2.0).

error on Canvas Pages in facebook

Notice: Undefined variable: _SESSION in Facebook->clearPersistentData() (line 130 of /home/domains/xxxx.net/public_html/sites/all/libraries/facebook-php-sdk/src/facebook.php).

Comments

Dave Cohen’s picture

I consider this a bug in facebook's PHP SDK which we cannot fix directly. Probably a snippet of code like this will work around the notice:

if (!isset($_SESSION)) {
  $_SESSION = NULL;
}

however I'm not sure exactly when that notice is appearing. I'm not sure exactly where to put that snippet.

MikeDivine’s picture

Status: Active » Needs review

Notice: Undefined variable: _SESSION in Facebook->clearPersistentData() (line 130 of ..../sites/all/libraries/facebook-php-sdk/src/facebook.php).

Yes I replaced with the following which seemed to fix the error.

if (isset($_SESSION[$session_var_name])) {
unset($_SESSION[$session_var_name]);
}

kopeboy’s picture

Component: Canvas Pages (iframe) » Facebook Connect

I had that error, fixed like MikeDivine said, but when I try to Connect with facebook, still nothing happens.
The facebook pop-up opens, closes by itself before showing anything (like "my app" is asking for permission etc.. Allow..), and I am still at my site homepage, logged out, without any message. Nothing happened. I tried with 2 diff. PCs, they were both logged on facebook (different accounts) and logged out from the site (one was registered, me, administrator, the other had never registered to my drupal site).

itamair’s picture

I am having the (quite) same problem.
I log in my Drupal site (Facebook App) with my Facebook Account (as administrator of the site).
It simultaneously runs the login to my Facebook, someway in the background.
Then when I try to logout from Drupal site, it doesn't logout with that above mentioned error …
"Notice: Undefined variable: _SESSION in Facebook->clearPersistentData() (line 130 of /home/itamair/public_html/geoblogcms/sites/all/libraries/facebook-php-sdk/src/facebook.php)."

I am able to log out from the Drupal site just after I log out from Facebook before. No way otherwise.
This seems to be a very major problem/matter with this module, if not fixed.

PS1: the #2 workaround made the error/warning message just go away but didn't cure anything. I am totally unable to logout from the site. So better to have the error warning, at least … that highlights something is not working properly, on the DfF module
PS2: I had activated the Facebook Canvas submodule, the de activated and unistalled it. But this issue/bug is still present ...

evgen’s picture

Version: 7.x-3.3-beta4 » 7.x-3.x-dev

Tell me, please, how to solve this problem. The module Drupal for Facebook is installed in our site and so we have also the library
Facebook PHP SDK (v.3.2.1) used here. Also the application in Facebook is registered. It has already been output from sandbox. The canvas was customized.The application has all normal settings. A user should be registered in the application and at the same time the account must be saved in the site.
The problem is that the Facebook user can not create his account (register) and instead of it the error of session Notice is displayed: Undefined variable: _SESSION in Facebook->clearPersistentData() (line 130 of
/srv/http/fc.dev/www/sites/all/libraries/facebook-php-sdk/src/facebook.php.
Where is the problem? What are the possible ways of solving it? Here's a link to the application: https://apps.facebook.com/freecouponcomua. Thank you.

itamair’s picture

Any help on this???

itamair’s picture

Ok. In my case I found the bug and fixed it. In my case I am using a multilingual site, so the problem was caused by the language identifier in the url.
Here #2059911: Couldn't logout from both Drupal and Facebook, with language url identifier is how I solved mine case, that I hope regards all you too …

;-)

aronne’s picture

hi guys, if u have problems on logout using fbconnect here is the solution:
add the 'access_token' param as shown below in the getLogoutUrl function

/**
 * Implements hook_user_logout().
 */
function fbconnect_user_logout() {
  // Redirect user to Facebook logout url.
  $client = facebook_client();
  if ($client && $fbuid = $client->getUser() && variable_get('fbconnect_loginout_mode') == 'auto') {
    session_destroy();
    global $base_url;
    $url = $client->getLogoutUrl(array('next' => $base_url, 'access_token' => $client->getAccessToken()));
    drupal_goto($url);
  }
}

That's all.

Bell@

P.S. Patch is attached

amberau79’s picture

Is this patch even for this module? There is no fbconnect.module file..

Dave Cohen’s picture

Status: Needs review » Closed (duplicate)

Please try the latest patch at #2059911: Couldn't logout from both Drupal and Facebook, with language url identifier and let me know whether that solves the problem.

amberau79’s picture

Thank you, that did resolve the issue.

Stef Coene’s picture

Status: Closed (duplicate) » Active

I'm going to activate this bug report. I have the same issue.
I can connect with facebook and the app appears as connected app in facebook, but the user is not created on my website.

Stef

spsole’s picture

In my case the problem solved when i enabled the apache rewrite mod and drupal clean urls

evgen’s picture

Issue summary: View changes
Status: Active » Closed (outdated)