use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
* upload_progress.freq, "1%"
* upload_progress.min-freq, "1"
* url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset="
+ * sid_length, "32"
+ * sid_bits_per_character, "5"
+ * trans_sid_hosts, $_SERVER['HTTP_HOST']
+ * trans_sid_tags, "a=href,area=href,frame=src,form="
*
* @param array $options Session configuration options
* @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler
return true;
}
- if (\PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) {
+ if (\PHP_SESSION_ACTIVE === session_status()) {
throw new \RuntimeException('Failed to start the session: already started by PHP.');
}
- if (\PHP_VERSION_ID < 50400 && !$this->closed && isset($_SESSION) && session_id()) {
- // not 100% fool-proof, but is the most reliable way to determine if a session is active in PHP 5.3
- throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).');
- }
-
if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
}
}
$this->loadSession();
- if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
- // This condition matches only PHP 5.3 with internal save handlers
- $this->saveHandler->setActive(true);
- }
return true;
}
public function regenerate($destroy = false, $lifetime = null)
{
// Cannot regenerate the session ID for non-active sessions.
- if (\PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) {
- return false;
- }
-
- // Check if session ID exists in PHP 5.3
- if (\PHP_VERSION_ID < 50400 && '' === session_id()) {
+ if (\PHP_SESSION_ACTIVE !== session_status()) {
return false;
}
{
session_write_close();
- if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
- // This condition matches only PHP 5.3 with internal save handlers
- $this->saveHandler->setActive(false);
- }
-
$this->closed = true;
$this->started = false;
}
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags',
+ 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
));
foreach ($options as $key => $value) {
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
$saveHandler = new SessionHandlerProxy($saveHandler);
} elseif (!$saveHandler instanceof AbstractProxy) {
- $saveHandler = \PHP_VERSION_ID >= 50400 ?
- new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy();
+ $saveHandler = new SessionHandlerProxy(new \SessionHandler());
}
$this->saveHandler = $saveHandler;
if ($this->saveHandler instanceof \SessionHandlerInterface) {
- if (\PHP_VERSION_ID >= 50400) {
- session_set_save_handler($this->saveHandler, false);
- } else {
- session_set_save_handler(
- array($this->saveHandler, 'open'),
- array($this->saveHandler, 'close'),
- array($this->saveHandler, 'read'),
- array($this->saveHandler, 'write'),
- array($this->saveHandler, 'destroy'),
- array($this->saveHandler, 'gc')
- );
- }
+ session_set_save_handler($this->saveHandler, false);
}
}