8000 Merge branch '6.2' into 6.3 · symfony/symfony@8e9ebc4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e9ebc4

Browse files
Merge branch '6.2' into 6.3
* 6.2: Autowire the PSR ClockInterface [Mime] Rename SMimeEncryptorTest to SMimeEncrypterTest [SecurityBundle] Fix `logout.csrf_token_generator` default value Remove redundant version information from deprecation Fix too eager deprecations for PhpAstExtractor Run tests with doctrine/collections 2
2 parents c79d4ab + faa55a6 commit 8e9ebc4

File tree

12 files changed

+53
-11
lines changed

12 files changed

+53
-11
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"async-aws/sns": "^1.0",
125125
"cache/integration-tests": "dev-master",
126126
"doctrine/annotations": "^1.13.1",
127-
"doctrine/collections": "~1.0",
127+
"doctrine/collections": "^1.0|^2.0",
128128
"doctrine/data-fixtures": "^1.1",
129129
"doctrine/dbal": "^2.13.1|^3.0",
130130
"doctrine/orm": "^2.7.4",

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"symfony/translation": "^5.4|^6.0",
4444
"symfony/var-dumper": "^5.4|^6.0",
4545
"doctrine/annotations": "^1.10.4",
46-
"doctrine/collections": "~1.0",
46+
"doctrine/collections": "^1.0|^2.0",
4747
"doctrine/data-fixtures": "^1.1",
4848
"doctrine/dbal": "^2.13.1|^3.0",
4949
"doctrine/orm": "^2.7.4",

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use PhpParser\Parser;
2121
use PHPStan\PhpDocParser\Parser\PhpDocParser;
2222
use Psr\Cache\CacheItemPoolInterface;
23+
use Psr\Clock\ClockInterface as PsrClockInterface;
2324
use Psr\Container\ContainerInterface as PsrContainerInterface;
2425
use Psr\Http\Client\ClientInterface;
2526
use Psr\Log\LoggerAwareInterface;
@@ -277,6 +278,7 @@ public function load(array $configs, ContainerBuilder $container)
277278
if (!ContainerBuilder::willBeAvailable('symfony/clock', ClockInterface::class, ['symfony/framework-bundle'])) {
278279
$container->removeDefinition('clock');
279280
$container->removeAlias(ClockInterface::class);
281+
$container->removeAlias(PsrClockInterface::class);
280282
}
281283

282284
$container->registerAliasForArgument('parameter_bag', PsrContainerInterface::class);
@@ -1306,9 +1308,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
13061308
$container->removeDefinition('translation.locale_switcher');
13071309
}
13081310

1309-
if (ContainerBuilder::willBeAvailable('nikic/php-parser', Parser::class, ['symfony/translation'])
1310-
&& ContainerBuilder::willBeAvailable('symfony/translation', PhpAstExtractor::class, ['symfony/framework-bundle'])
1311-
) {
1311+
// don't use ContainerBuilder::willBeAvailable() as these are not needed in production
1312+
if (interface_exists(Parser::class) && class_exists(PhpAstExtractor::class)) {
13121313
$container->removeDefinition('translation.extractor.php');
13131314
} else {
13141315
$container->removeDefinition('translation.extractor.php_ast');

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14+
use Psr\Clock\ClockInterface as PsrClockInterface;
1415
use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
1516
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer;
1617
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
@@ -230,6 +231,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
230231

231232
->set('clock', NativeClock::class)
232233
->alias(ClockInterface::class, 'clock')
234+
->alias(PsrClockInterface::class, 'clock')
233235

234236
// register as abstract and excluded, aka not-autowirable types
235237
->set(LoaderInterface::class)->abstract()->tag('container.excluded')

src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.php

Lines changed: 1 addition & 0 deletions
< F438 /colgroup>
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
->tag('translation.dumper', ['alias' => 'res'])
154154

155155
->set('translation.extractor.php', PhpExtractor::class)
156+
->deprecate('symfony/framework-bundle', '6.2', 'The "%service_id%" service is deprecated, use "translation.extractor.php_ast" instead.')
156157
->tag('translation.extractor', ['alias' => 'php'])
157158

158159
->set('translation.extractor.php_ast', PhpAstExtractor::class)

src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
->abstract()
4242
->set('.workflow.registry', Registry::class)
4343
->alias(Registry::class, '.workflow.registry')
44-
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated since Symfony 6.2 and will be removed in Symfony 7.0. Inject the workflow directly.')
44+
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated, inject the workflow directly.')
4545
->alias('workflow.registry', '.workflow.registry')
46-
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" service is deprecated since Symfony 6.2 and will be removed in Symfony 7.0. Inject the workflow directly.')
46+
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated, inject the workflow directly.')
4747
->set('workflow.security.expression_language', ExpressionLanguage::class)
4848
;
4949
};

src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
222222
if (isset($v['csrf_token_generator'])) {
223223
$v['enable_csrf'] = true;
224224
} elseif ($v['enable_csrf']) {
225-
$v['csrf_token_generator'] = 'security.csrf.token_generator';
225+
$v['csrf_token_generator'] = 'security.csrf.token_manager';
226226
}
227227

228228
return $v;

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function testLogoutCsrf()
122122

123123
$assertions = [
124124
'custom_token_generator' => [true, 'a_token_generator'],
125-
'default_token_generator' => [true, 'security.csrf.token_generator'],
125+
'default_token_generator' => [true, 'security.csrf.token_manager'],
126126
'disabled_csrf' => [false, null],
127127
'empty' => [false, null],
128128
];

src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ public function testCookieClearingOnLogout()
6969
$this->assertNull($cookieJar->get('flavor'));
7070
}
7171

72+
public function testEnabledCsrf()
73+
{
74+
$client = $this->createClient(['test_case' => 'Logout', 'root_config' => 'config_csrf_enabled.yml']);
75+
76+
$cookieJar = $client->getCookieJar();
77+
$cookieJar->set(new Cookie('flavor', 'chocolate', strtotime('+1 day'), null, 'somedomain'));
78+
79+
$client->request('POST', '/login', ['_username' => 'johannes', '_password' => 'test']);
80+
$client->request('GET', '/logout');
81+
82+
$this->assertResponseStatusCodeSame(Response::HTTP_FORBIDDEN);
83+
}
84+
7285
private function callInRequestContext(KernelBrowser $client, callable $callable): void
7386
{
7487
/** @var EventDispatcherInterface $eventDispatcher */
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
imports:
2+
- { resource: ./../config/framework.yml }
3+
4+
security:
5+
password_hashers:
6+
Symfony\Component\Security\Core\User\InMemoryUser: plaintext
7+
8+
providers:
9+
in_memory:
10+
memory:
11+
users:
12+
johannes: { password: test, roles: [ROLE_USER] }
13+
14+
firewalls:
15+
default:
16+
form_login:
17+
check_path: login
18+
remember_me: true
19+
require_previous_session: false
20+
logout:
21+
enable_csrf: true
22+
23+
access_control:
24+
- { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
25+
- { path: .*, roles: IS_AUTHENTICATED_FULLY }

src/Symfony/Component/Form/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"symfony/service-contracts": "^1.1|^2|^3"
2828
},
2929
"require-dev": {
30-
"doctrine/collections": "~1.0",
30+
"doctrine/collections": "^1.0|^2.0",
3131
"symfony/validator": "^5.4|^6.0",
3232
"symfony/dependency-injection": "^5.4|^6.0",
3333
"symfony/expression-language": "^5.4|^6.0",

src/Symfony/Component/Mime/Tests/Crypto/SMimeEncryptorTest.php renamed to src/Symfony/Component/Mime/Tests/Crypto/SMimeEncrypterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* @requires extension openssl
2121
*/
22-
class SMimeEncryptorTest extends SMimeTestCase
22+
class SMimeEncrypterTest extends SMimeTestCase
2323
{
2424
public function testEncryptMessage()
2525
{

0 commit comments

Comments
 (0)
0