From 19eeac88cae1441d446a16522c82526c7c1c9280 Mon Sep 17 00:00:00 2001 From: Drak Date: Fri, 29 Jun 2012 18:05:14 +0100 Subject: [PATCH] [HttpFoundation] Removed erroneous reliance on session.auto_start --- .../Session/Storage/NativeSessionStorage.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index d5bcca14fb11..965c786f85e9 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -61,7 +61,9 @@ class NativeSessionStorage implements SessionStorageInterface * @see http://php.net/session.configuration for options * but we omit 'session.' from the beginning of the keys for convenience. * - * auto_start, "0" + * ("auto_start", is not supported as it tells PHP to start a session before + * PHP starts to execute user-land code. Setting during runtime has no effect). + * * cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). * cookie_domain, "" * cookie_httponly, "" @@ -95,8 +97,6 @@ class NativeSessionStorage implements SessionStorageInterface */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - // sensible defaults - ini_set('session.auto_start', 0); // by default we prefer to explicitly start the session using the class. ini_set('session.cache_limiter', ''); // disable by default because it's managed by HeaderBag (if used) ini_set('session.use_cookies', 1); @@ -256,10 +256,10 @@ public function getBag($name) throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); } - if (ini_get('session.auto_start') && !$this->started) { - $this->start(); - } elseif ($this->saveHandler->isActive() && !$this->started) { + if ($this->saveHandler->isActive() && !$this->started) { $this->loadSession(); + } elseif (!$this->started) { + $this->start(); } return $this->bags[$name]; @@ -302,7 +302,7 @@ public function getMetadataBag() public function setOptions(array $options) { $validOptions = array_flip(array( - 'auto_start', 'cache_limiter', 'cookie_domain', 'cookie_httponly', + 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',