webtechnick/CakePHP-Facebook-Plugin — Issue #56: Facebook::__construct() call session_start() before CakeSession
Author: dario1985
Created: 2012-02-29 09:32:38+00:00
State: open

Seem that Facebook SDK class breaks cakephp session behavior starting session outside of session component, because of CakePHP1.3 (2.0+ too?) starts session in SessionComponent::startup() after Components::initialize and Controller::beforeFilter() in Controller::startupProcess.

So, database and cake sessions dont work.

I temporary solved with a workaround patching ConnectComponent::initialize() to force Session start before of Facebook::__construct().

```php
function initialize(&$Controller, $settings = array()){
$this->Controller = $Controller;
if (!$this->Controller->Session->started()) {
$this->Controller->Session->start();
}
$this->_set($settings);
$this->FB = new FB();
$this->uid = $this->FB->getUser();
}
```