Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[HttpFoundation] Removed erroneous reliance on session.auto_start
  • Loading branch information
Drak committed Jun 29, 2012
1 parent dcac5d7 commit 19eeac8
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -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, ""
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 19eeac8

Please sign in to comment.