public function NativeSessionStorage::start in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::start()
Starts the session.
Return value
bool True if started.
Throws
\RuntimeException If something goes wrong starting the session.
Overrides SessionStorageInterface::start
2 calls to NativeSessionStorage::start()
- NativeSessionStorage::getBag in vendor/
symfony/ http-foundation/ Session/ Storage/ NativeSessionStorage.php - Gets a SessionBagInterface by name.
- SessionManager::startNow in core/
lib/ Drupal/ Core/ Session/ SessionManager.php - Forcibly start a PHP session.
2 methods override NativeSessionStorage::start()
- PhpBridgeSessionStorage::start in vendor/
symfony/ http-foundation/ Session/ Storage/ PhpBridgeSessionStorage.php - Starts the session.
- SessionManager::start in core/
lib/ Drupal/ Core/ Session/ SessionManager.php - Starts the session.
File
- vendor/
symfony/ http-foundation/ Session/ Storage/ NativeSessionStorage.php, line 128
Class
- NativeSessionStorage
- This provides a base class for session attribute storage.
Namespace
Symfony\Component\HttpFoundation\Session\StorageCode
public function start() {
if ($this->started) {
return true;
}
if (PHP_VERSION_ID >= 50400 && \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));
}
// ok to try and start the session
if (!session_start()) {
throw new \RuntimeException('Failed to start the session');
}
$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;
}