Skip to content

Commit

Permalink
Merge branch '4.0'
Browse files Browse the repository at this point in the history
* 4.0:
  PhpDoc: There is no attempt to create the directory
  Avoiding an error when an unused service has a missing base class
  Add an implementation just for php 7.0
  bumped Symfony version to 2.7.47
  Fix #27011: Session ini_set bug
  [Cache] TagAwareAdapterInterface::invalidateTags() should commit deferred items
  updated VERSION for 2.7.46
  update CONTRIBUTORS for 2.7.46
  updated CHANGELOG for 2.7.46
  bug #25844 [HttpKernel] Catch HttpExceptions when templating is not installed
  • Loading branch information
nicolas-grekas committed Apr 30, 2018
2 parents a71f82d + 0144877 commit ce1e2a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Session/Storage/NativeSessionStorage.php
Expand Up @@ -346,20 +346,20 @@ public function setOptions(array $options)
}

$validOptions = array_flip(array(
'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly',
'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cookie_lifetime', 'cookie_path', 'cookie_secure',
'gc_divisor', 'gc_maxlifetime', 'gc_probability',
'lazy_write', 'name', 'referer_check',
'serialize_handler', 'use_strict_mode', 'use_cookies',
'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',
'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 (isset($validOptions[$key])) {
ini_set('session.'.$key, $value);
ini_set('url_rewriter.tags' !== $key ? 'session.'.$key : $key, $value);
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions Tests/Session/Storage/NativeSessionStorageTest.php
Expand Up @@ -182,6 +182,23 @@ public function testCookieOptions()
$this->assertEquals($options, $gco);
}

public function testSessionOptions()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is not handled in this test case.');
}

$options = array(
'url_rewriter.tags' => 'a=href',
'cache_expire' => '200',
);

$this->getStorage($options);

$this->assertSame('a=href', ini_get('url_rewriter.tags'));
$this->assertSame('200', ini_get('session.cache_expire'));
}

/**
* @expectedException \InvalidArgumentException
*/
Expand Down

0 comments on commit ce1e2a0

Please sign in to comment.