8000 minor #58262 [HttpFoundation] move setting deprecation session option… · symfony/symfony@de845c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit de845c2

Browse files
committed
minor #58262 [HttpFoundation] move setting deprecation session options into a legacy group test (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [HttpFoundation] move setting deprecation session options into a legacy group test | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- c776453 move setting deprecation session options into a legacy group test
2 parents aef8ed5 + c776453 commit de845c2

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 23 additions & 3 deletions
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)
0