From ae0d217e5932aa0b70ddb4cf7822cc76d48aee53 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 13 Sep 2024 22:50:27 +0200 Subject: [PATCH] move setting deprecation session options into a legacy group test --- .../Storage/NativeSessionStorageTest.php | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Tests/Session/Storage/NativeSessionStorageTest.php b/Tests/Session/Storage/NativeSessionStorageTest.php index c67b1391d..d5ee85f62 100644 --- a/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/Tests/Session/Storage/NativeSessionStorageTest.php @@ -207,19 +207,39 @@ public function testCookieOptions() $this->assertEquals($options, $gco); } - public function testSessionOptions() + public function testCacheExpireOption() { $options = [ - 'trans_sid_tags' => 'a=href', 'cache_expire' => '200', ]; $this->getStorage($options); - $this->assertSame('a=href', \ini_get('session.trans_sid_tags')); $this->assertSame('200', \ini_get('session.cache_expire')); } + /** + * 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. + */ + public function testTransSidTagsOption() + { + $previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler) { + if ('ini_set(): Usage of session.trans_sid_tags INI setting is deprecated' !== $errstr) { + return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false; + } + }); + + try { + $this->getStorage([ + 'trans_sid_tags' => 'a=href', + ]); + } finally { + restore_error_handler(); + } + + $this->assertSame('a=href', \ini_get('session.trans_sid_tags')); + } + public function testSetSaveHandler() { $initialSaveHandler = ini_set('session.save_handler', 'files');