Skip to content

Commit ae0d217

Browse files
committed
move setting deprecation session options into a legacy group test
1 parent a414c5d commit ae0d217

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

Tests/Session/Storage/NativeSessionStorageTest.php

+23-3
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,39 @@ public function testCookieOptions()
207207
$this->assertEquals($options, $gco);
208208
}
209209

210-
public function testSessionOptions()
210+
public function testCacheExpireOption()
211211
{
212212
$options = [
213-
'trans_sid_tags' => 'a=href',
214213
'cache_expire' => '200',
215214
];
216215

217216
$this->getStorage($options);
218217

219-
$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
220218
$this->assertSame('200', \ini_get('session.cache_expire'));
221219
}
222220

221+
/**
222+
* The test must only be removed when the "session.trans_sid_tags" option is removed from PHP or when the "trans_sid_tags" option is no longer supported by the native session storage.
223+
*/
224+
public function testTransSidTagsOption()
225+
{
226+
$previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler) {
227+
if ('ini_set(): Usage of session.trans_sid_tags INI setting is deprecated' !== $errstr) {
228+
return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false;
229+
}
230+
});
231+
232+
try {
233+
$this->getStorage([
234+
'trans_sid_tags' => 'a=href',
235+
]);
236+
} finally {
237+
restore_error_handler();
238+
}
239+
240+
$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
241+
}
242+
223243
public function testSetSaveHandler()
224244
{
225245
$initialSaveHandler = ini_set('session.save_handler', 'files');

0 commit comments

Comments
 (0)