I am experiencing weird behaviour with my session adapter. In my application I am using the following:
$di->setShared('session', function () use ($config) {
$session = new Phalcon\Session\Adapter\Files();
$session->start();
return $session;
});
In my controller I have the following code
$this->persistent->searchedPhrase = "test";
This seems to be working only partialy. It does set $_SESSION['searchedPhrase'] however if I want to access it on next request using $this->persistent->searchedPhrase I am getting a null value. There is no problem accessing it through $_SESSION['searchedPhrase']. Another weird issue is that if I use
$this->session->set("searchedPhrase1", "test");
this variable is visible in $_SESSION global only for the current request, it does not get stored for me to access it later. My $session->isStarted() is returning false, but still I am able to access a number of session variables I set in other places... The only way that now seems to be working is to add at the end of my main index.php call to session_write_close()
echo $application->handle()->getContent();
session_write_close();
So it seems that something is interrupting saving of session data. What could be the cause?