bug #27067 [HttpFoundation] Fix setting session-related ini settings (e-moe)

This PR was merged into the 2.7 branch.

Discussion
----------

[HttpFoundation] Fix setting session-related ini settings

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27011
| License       | MIT
| Doc PR        | n/a

Added missed option `cache_expire`
Fixed typo in `upload_progress.min_freq`
Fixed ini_set name prefix of `url_rewriter.tags`

Commits
-------

64a0f23aff Fix #27011: Session ini_set bug
This commit is contained in:
Tobias Schultze 2018-04-28 18:57:47 +02:00
commit 81c9545200
2 changed files with 20 additions and 3 deletions

View File

@ -340,7 +340,7 @@ class NativeSessionStorage implements SessionStorageInterface
}
$validOptions = array_flip(array(
'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cache_expire', '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',
@ -348,13 +348,13 @@ class NativeSessionStorage implements SessionStorageInterface
'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);
}
}
}

View File

@ -183,6 +183,23 @@ class NativeSessionStorageTest extends TestCase
$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
*/