8000 Merge branch '7.2' into 7.3 · symfony/symfony@f194b1b · GitHub
[go: up one dir, main page]

Skip to content

Commit f194b1b

Browse files
Merge branch '7.2' into 7.3
* 7.2: Revert "bug #58937 [FrameworkBundle] Don't auto-register form/csrf when the corresponding components are not installed (nicolas-grekas)" Fix merge fix: ignore missing directory in isVendor() [OptionsResolver] Allow Union/Intersection Types in Resolved Closures Issue #58821: [DependencyInjection] Support interfaces in ContainerBuilder::getReflectionClass(). Dynamically fix compatibility with doctrine/data-fixtures v2 [HttpKernel] Ensure HttpCache::getTraceKey() does not throw exception don't call EntityManager::initializeObject() with scalar values [FrameworkBundle] Don't auto-register form/csrf when the corresponding components are not installed make RelayProxyTrait compatible with relay extension 0.9.0 [Validator] review italian translations Update PR template
2 parents bec056a + 1fe94ae commit f194b1b

26 files changed

+401
-91
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | 7.2 for features / 5.4, 6.4, and 7.1 for bug fixes <!-- see below -->
3+
| Branch? | 7.3 for features / 5.4, 6.4, 7.1, and 7.2 for bug fixes <!-- see below -->
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
66
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->

.github/expected-missing-return-types.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Run these steps to update this file:
2-
sed -i 's/ *"\*\*\/Tests\/",\?//' composer.json
2+
sed -i 's/ *"\*\*\/Tests\/",//' composer.json
33
composer u -o
44
SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.1' php .github/patch-types.php
55
head=$(sed '/^diff /Q' .github/expected-missing-return-types.diff)

src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderPostgresTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function setUpBeforeClass(): void
2121
}
2222
}
2323

24-
protected function bootstrapProvider()
24+
protected function bootstrapProvider(): DoctrineTokenProvider
2525
{
2626
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
2727
if (class_exists(DefaultSchemaManagerFactory::class)) {

src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function testVerifyOutdatedTokenAfterParallelRequestFailsAfter60Seconds()
117117
$this->assertFalse($provider->verifyToken($token, $oldValue));
118118
}
119119

120-
private function bootstrapProvider(): DoctrineTokenProvider
120+
protected function bootstrapProvider(): DoctrineTokenProvider
121121
{
122122
$config = ORMSetup::createConfiguration(true);
123123
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function validate(mixed $value, Constraint $constraint): void
105105

106106
$criteria[$fieldName] = $fieldValue;
107107

108-
if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) {
108+
if (\is_object($criteria[$fieldName]) && $class->hasAssociation($fieldName)) {
109109
/* Ensure the Proxy is initialized before using reflection to
110110
* read its identifiers. This is necessary because the wrapped
111111
* getter methods in the Proxy are being bypassed.

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"symfony/validator": "^6.4|^7.0",
4545
"symfony/var-dumper": "^6.4|^7.0",
4646
"doctrine/collections": "^1.8|^2.0",
47-
"doctrine/data-fixtures": "^1.1",
47+
"doctrine/data-fixtures": "^1.1|^2",
4848
"doctrine/dbal": "^3.6|^4",
4949
"doctrine/orm": "^2.15|^3",
5050
"psr/log": "^1|^2|^3"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode): void
211211
->addDefaultsIfNotSet()
212212
->fixXmlConfig('stateless_token_id')
213213
->children()
214-
// defaults to framework.csrf_protection.stateless_token_ids || framework.session.enabled && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class)
214+
// defaults to (framework.csrf_protection.stateless_token_ids || framework.session.enabled) && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class)
215215
->scalarNode('enabled')->defaultNull()->end()
216216
->arrayNode('stateless_token_ids')
217217
->scalarPrototype()->end()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,9 @@ public function load(array $configs, ContainerBuilder $container): void
466466
$container->removeDefinition('test.session.listener');
467467
}
468468 10BC0

469-
// csrf depends on session being registered
469+
// csrf depends on session or stateless token ids being registered
470470
if (null === $config['csrf_protection']['enabled']) {
471-
$this->writeConfigEnabled('csrf_protection', $config['csrf_protection']['stateless_token_ids'] || $this->readConfigEnabled('session', $container, $config['session']) && !class_exists(FullStack::class) && ContainerBuilder::willBeAvailable('symfony/security-csrf', CsrfTokenManagerInterface::class, ['symfony/framework-bundle']), $config['csrf_protection']);
471+
$this->writeConfigEnabled('csrf_protection', ($config['csrf_protection']['stateless_token_ids'] || $this->readConfigEnabled('session', $container, $config['session'])) && !class_exists(FullStack::class) && ContainerBuilder::willBeAvailable('symfony/security-csrf', CsrfTokenManagerInterface::class, ['symfony/framework-bundle']), $config['csrf_protection']);
472472
}
473473
$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
474474

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/form_csrf_disabled.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<framework:annotations enabled="false"/>
1313
<framework:php-errors log="true" />
1414
<framework:csrf-protection enabled="false"/>
15-
<framework:form enabled="true">
15+
<framework:form>
1616
<framework:csrf-protection enabled="true"/>
1717
</framework:form>
1818
</framework:config>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/form_no_csrf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<framework:config http-method-override="false" handle-all-throwables="true">
1010
<framework:annotations enabled="false" />
1111
<framework:php-errors log="true" />
12-
<framework:form enabled="true">
12+
<framework:form>
1313
<framework:csrf-protection enabled="false" />
1414
</framework:form>
1515
</framework:config>

src/Symfony/Component/AssetMapper/Factory/MappedAssetFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ private function isVendor(string $sourcePath): bool
129129
$sourcePath = realpath($sourcePath);
130130
$vendorDir = realpath($this->vendorDir);
131131

132-
return $sourcePath && str_starts_with($sourcePath, $vendorDir);
132+
return $sourcePath && $vendorDir && str_starts_with($sourcePath, $vendorDir);
133133
}
134134
}

src/Symfony/Component/AssetMapper/Tests/Factory/MappedAssetFactoryTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
class MappedAssetFactoryTest extends TestCase
2828
{
29+
private const DEFAULT_FIXTURES = __DIR__.'/../Fixtures/assets/vendor';
30+
2931
private AssetMapperInterface&MockObject $assetMapper;
3032

3133
public function testCreateMappedAsset()
@@ -137,7 +139,15 @@ public function testCreateMappedAssetInVendor()
137139
$this->assertTrue($asset->isVendor);
138140
}
139141

140-
private function createFactory(?AssetCompilerInterface $extraCompiler = null): MappedAssetFactory
142+
public function testCreateMappedAssetInMissingVendor()
143+
{
144+
$assetMapper = $this->createFactory(null, '/this-path-does-not-exist/');
145+
$asset = $assetMapper->createMappedAsset('lodash.js', __DIR__.'/../Fixtures/assets/vendor/lodash/lodash.index.js');
146+
$this->assertSame('lodash.js', $asset->logicalPath);
147+
$this->assertFalse($asset->isVendor);
148+
}
149+
150+
private function createFactory(?AssetCompilerInterface $extraCompiler = null, ?string $vendorDir = self::DEFAULT_FIXTURES): MappedAssetFactory
141151
{
142152
$compilers = [
143153
new JavaScriptImportPathCompiler($this->createMock(ImportMapConfigReader::class)),
@@ -162,7 +172,7 @@ private function createFactory(?AssetCompilerInterface $extraCompiler = null): M
162172
$factory = new MappedAssetFactory(
163173
$pathResolver,
164174
$compiler,
165-
__DIR__.'/../Fixtures/assets/vendor',
175+
$vendorDir,
166176
);
167177

168178
// mock the AssetMapper to behave like normal: by calling back to the factory
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.8.1', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait CopyTrait
19+
{
20+
public function copy($src, $dst, $options = null): \Relay\Relay|bool
21+
{
22+
return $this->initializeLazyObject()->copy(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait CopyTrait
30+
{
31+
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
32+
{
33+
return $this->initializeLazyObject()->copy(...\func_get_args());
34+
}
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait GeosearchTrait
19+
{
20+
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array|false
21+
{
22+
return $this->initializeLazyObject()->geosearch(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait GeosearchTrait
30+
{
31+
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array
32+
{
33+
return $this->initializeLazyObject()->geosearch(...\func_get_args());
34+
}
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait GetrangeTrait
19+
{
20+
public function getrange($key, $start, $end): mixed
21+
{
22+
return $this->initializeLazyObject()->getrange(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait GetrangeTrait
30+
{
31+
public function getrange($key, $start, $end): \Relay\Relay|false|string
32+
{
33+
return $this->initializeLazyObject()->getrange(...\func_get_args());
34+
}
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait HsetTrait
19+
{
20+
public function hset($key, ...$keys_and_vals): \Relay\Relay|false|int
21+
{
22+
return $this->initializeLazyObject()->hset(...\func_get_args());
23+
}
24+
}
25+
} else {
26+
/**
27+
* @internal
28+
*/
29+
trait HsetTrait
30+
{
31+
public function hset($key, $mem, $val, ...$kvals): \Relay\Relay|false|int
32+
{
33+
return $this->initializeLazyObject()->hset(...\func_get_args());
34+
}
35+
}
36+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits\Relay;
13+
14+
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait MoveTrait
19+
{
20+
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): mixed
21+
{
22+
return $this->initializeLazyObject()->blmove(...\func_get_args());
23+
}
24+
25+
public function lmove($srckey, $dstkey, $srcpos, $dstpos): mixed
26+
{
27+
return $this->initializeLazyObject()->lmove(...\func_get_args());
28+
}
29+
}
30+
} else {
31+
/**
32+
* @internal
33+
*/
34+
trait MoveTrait
35+
{
36+
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|null|string
37+
{
38+
return $this->initializeLazyObject()->blmove(...\func_get_args());
39+
}
40+
41+
public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|null|string
42+
{
43+
return $this->initializeLazyObject()->lmove(...\func_get_args());
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)
< 2B17 /div>
0