Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,10 @@ public function testCacheExpireOption()
#[Group('legacy')]
public function testTransSidTagsOption()
{
$unignoredErrors = [];
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_tags" option is deprecated and will be ignored in Symfony 8.0.');

$previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler, &$unignoredErrors) {
$previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler) {
if ('ini_set(): Usage of session.trans_sid_tags INI setting is deprecated' !== $errstr) {
$unignoredErrors[] = $errstr;

return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false;
}
});
Expand All @@ -245,8 +243,6 @@ public function testTransSidTagsOption()
restore_error_handler();
}

$this->assertCount(1, $unignoredErrors);
$this->assertSame('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_tags" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors[0]);
$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
}

Expand Down Expand Up @@ -376,15 +372,13 @@ public function testSaveHandlesNullSessionGracefully()
#[Group('legacy')]
public function testPassingDeprecatedOptions()
{
$unignoredErrors = [];

$previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler, &$unignoredErrors) {
if (!preg_match('/^ini_set\(\):( Disabling| Usage of)? session\..+ is deprecated$/', $errstr)) {
$unignoredErrors[] = $errstr;

return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false;
}
});
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "sid_length" option is deprecated and will be ignored in Symfony 8.0.');
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "sid_bits_per_character" option is deprecated and will be ignored in Symfony 8.0.');
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "referer_check" option is deprecated and will be ignored in Symfony 8.0.');
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "use_only_cookies" option is deprecated and will be ignored in Symfony 8.0.');
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "use_trans_sid" option is deprecated and will be ignored in Symfony 8.0.');
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_hosts" option is deprecated and will be ignored in Symfony 8.0.');
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_tags" option is deprecated and will be ignored in Symfony 8.0.');

$this->getStorage([
'sid_length' => 42,
Expand All @@ -395,14 +389,5 @@ public function testPassingDeprecatedOptions()
'trans_sid_hosts' => 'foo',
'trans_sid_tags' => 'foo',
]);

$this->assertCount(7, $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "sid_length" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "sid_bits_per_character" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "referer_check" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "use_only_cookies" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "use_trans_sid" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_hosts" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
$this->assertContains('Since symfony/http-foundation 7.2: NativeSessionStorage\'s "trans_sid_tags" option is deprecated and will be ignored in Symfony 8.0.', $unignoredErrors);
}
}