Skip to content

Commit 7a61d31

Browse files
committed
Fix #27011: Session ini_set bug
1 parent 1d170f9 commit 7a61d31

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Session/Storage/NativeSessionStorage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,21 +340,21 @@ public function setOptions(array $options)
340340
}
341341

342342
$validOptions = array_flip(array(
343-
'cache_limiter', 'cookie_domain', 'cookie_httponly',
343+
'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
344344
'cookie_lifetime', 'cookie_path', 'cookie_secure',
345345
'entropy_file', 'entropy_length', 'gc_divisor',
346346
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
347347
'hash_function', 'lazy_write', 'name', 'referer_check',
348348
'serialize_handler', 'use_strict_mode', 'use_cookies',
349349
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
350350
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
351-
'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags',
351+
'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags',
352352
'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
353353
));
354354

355355
foreach ($options as $key => $value) {
356356
if (isset($validOptions[$key])) {
357-
ini_set('session.'.$key, $value);
357+
ini_set('url_rewriter.tags' !== $key ? 'session.'.$key : $key, $value);
358358
}
359359
}
360360
}

Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ public function testCookieOptions()
183183
$this->assertEquals($options, $gco);
184184
}
185185

186+
public function testSessionOptions()
187+
{
188+
if (defined('HHVM_VERSION')) {
189+
$this->markTestSkipped('HHVM is not handled in this test case.');
190+
}
191+
192+
$options = array(
193+
'url_rewriter.tags' => 'a=href',
194+
'cache_expire' => '200',
195+
);
196+
197+
$this->getStorage($options);
198+
199+
$this->assertSame('a=href', ini_get('url_rewriter.tags'));
200+
$this->assertSame('200', ini_get('session.cache_expire'));
201+
}
202+
186203
/**
187204
* @expectedException \InvalidArgumentException
188205
*/

0 commit comments

Comments
 (0)