title: Native PHP session variables are automatically destroy after Facebook PHP login
body: <p>I am using facebook php sdk 4 for my application. I have added few data on $_SESSION. But those session variables are getting erased after login using FacebookRedirectLoginHelper::getLoginUrl. Here is code below:</p>
  
  <pre><code>session_start();
  session_regenerate_id(true);
  
  
  define( 'ROOT', dirname( __FILE__ ) . '/' );
  
  
  require_once( ROOT . 'facebook-php-sdk-v4-4.0-dev/autoload.php' );
  
  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  
  $app_id = 'MY ID';
  $app_secret = 'MY SEC';
  $redirect_uri = 'http://myurl.com/a1.php';
  
  // Requested permissions for the app - optional
  $permissions = array(
    'email',
    'user_location',
    'user_birthday',
      'publish_actions'
  );
  
  
  
  // Initialize the SDK
  FacebookSession::setDefaultApplication( $app_id, $app_secret );
  
  $helper = new FacebookRedirectLoginHelper( $redirect_uri );
  
  
  if ( isset( $_SESSION ) &amp;&amp; isset( $_SESSION['fb_token'] ) ) 
  {
  
    $session = new FacebookSession( $_SESSION['fb_token'] );
  
      try {
        if ( ! $session-&gt;validate() ) {
          $session = null;
        }
      } catch ( Exception $e ) {
        // Catch any exceptions
        $session = null;
      }
  } else {
  
    try {
      $session = $helper-&gt;getSessionFromRedirect();
    } catch( FacebookRequestException $ex ) {
  
  
    } catch( Exception $ex ) {
  
  
      echo $ex-&gt;message;
    }
  }
  
  
  if ( isset( $session ) ) {
  
  
    $_SESSION['fb_token'] = $session-&gt;getToken();
  
  
    $session = new FacebookSession( $session-&gt;getToken() );
  
  
  
  
  
  }
  
  else {
    // No session
  
  $_SESSION["V_ActualData_Message"]="My Message"; **// I am not getting this one on $redirect_uri here  http://myurl.com/a1.php**
  
    $loginUrl = $helper-&gt;getLoginUrl( $permissions );
    header('Location: ' . $loginUrl);
    exit;
    //echo '&lt;a href="' . $loginUrl . '"&gt;Log in with FaceBook&lt;/a&gt;';
  }
  </code></pre>
  
  <p>Here is the content of a1.php</p>
  
  <pre><code>session_start();
  define( 'ROOT', dirname( __FILE__ ) . '/' );
  
  require_once( ROOT . 'facebook-php-sdk-v4-4.0-dev/autoload.php' );
  
  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  use Facebook\FacebookRequest;
  
  $app_id = '377309525773973';
  $app_secret = '7db5a66e837f0c9e000fbf9ec4276d49';
  $redirect_uri = 'a1.php';
  
  $permissions = array(
    'email',
    'user_location',
    'user_birthday',
    'publish_actions'
  );
  
  
  FacebookSession::setDefaultApplication( $app_id, $app_secret );
  
  $helper = new FacebookRedirectLoginHelper($redirect_uri);
  
  if ( isset( $_SESSION ) &amp;&amp; isset( $_SESSION['fb_token'] ) ) {
  $session = new FacebookSession( $_SESSION['fb_token'] );
  try
  {
      if ( ! $session-&gt;validate($app_id,$app_secret) ) {
      $session = null;
      }
  } catch ( Exception $e ) {
        $session = null;
      }
  } else {
  
    try {
      $session = $helper-&gt;getSessionFromRedirect();
    } catch( FacebookRequestException $ex ) {
  
    } catch( Exception $ex ) {
  
      echo $ex-&gt;getMessage();
    }
  }
  
   try {
      $session = $helper-&gt;getSessionFromRedirect();
    } catch( FacebookRequestException $ex ) {
  
    } catch( Exception $ex ) {
  
      echo $ex-&gt;getMessage();
    }
  
  
  $message="";
  $message=$_SESSION['V_ActualData_Message'];
  
  if ( isset( $session ) ) {
  
    $_SESSION['fb_token'] = $session-&gt;getToken();
  
  generated at login
    $session = new FacebookSession( $session-&gt;getToken() );
  
    $logoutURL = $helper-&gt;getLogoutUrl( $session, 'facebookLogout.php' );
  
      try
      {
          $request = (new FacebookRequest( $session, 'POST', '/me/feed', array(
            'message' =&gt; $message
          )))-&gt;execute();
  
          $response = $request-&gt;getGraphObject()-&gt;asArray();
  
  
      }
      catch(FacebookClientException $ex)
      {
           echo $ex-&gt;getMessage();
      }
  
  
  
  echo "&lt;br/&gt;";
  echo "Submitted Message ID";
  echo "&lt;br/&gt;";
  print_r( $response );
  echo "&lt;br/&gt;";
  
    echo "&lt;br/&gt;";
  
    echo $message;
  
  
    echo "&lt;br/&gt;";
  
    echo '&lt;a href="' . $logoutURL . '"&gt;Log out&lt;/a&gt;';
  } else {
    // No session
  
    // Get login URL
    $loginUrl = $helper-&gt;getLoginUrl( $permissions );
  
    echo '&lt;a href="' . $loginUrl . '"&gt;Log in with FaceBook&lt;/a&gt;';
  }
  </code></pre>