Skip to content

Commit 3feb53b

Browse files
Merge branch '7.2' into 7.3
* 7.2: remove conflict with symfony/serializer < 6.4 Reviewed and Translated zh_CN [PropertyInfo] Fix write visibility for Asymmetric Visibility and Virtual Properties [Translation] [Bridge][Lokalise] Fix empty keys array in PUT, DELETE requests causing Lokalise API error Proofread UPGRADE guide
2 parents d867b12 + 00a6a2d commit 3feb53b

File tree

14 files changed

+289
-57
lines changed

14 files changed

+289
-57
lines changed

UPGRADE-7.2.md

Lines changed: 67 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,40 @@ Read more about this in the [Symfony documentation](https://symfony.com/doc/7.2/
88

99
If you're upgrading from a version below 7.1, follow the [7.1 upgrade guide](UPGRADE-7.1.md) first.
1010

11+
Table of Contents
12+
-----------------
13+
14+
Bundles
15+
16+
* [FrameworkBundle](#FrameworkBundle)
17+
18+
Bridges
19+
20+
* [TwigBridge](#TwigBridge)
21+
22+
Components
23+
24+
* [Cache](#Cache)
25+
* [Console](#Console)
26+
* [DependencyInjection](#DependencyInjection)
27+
* [Form](#Form)
28+
* [HttpFoundation](#HttpFoundation)
29+
* [Ldap](#Ldap)
30+
* [Lock](#Lock)
31+
* [Mailer](#Mailer)
32+
* [Notifier](#Notifier)
33+
* [Routing](#Routing)
34+
* [Security](#Security)
35+
* [Serializer](#Serializer)
36+
* [Translation](#Translation)
37+
* [Webhook](#Webhook)
38+
* [Yaml](#Yaml)
39+
1140
Cache
1241
-----
1342

14-
* `igbinary_serialize()` is not used by default when the igbinary extension is installed
43+
* `igbinary_serialize()` is no longer used instead of `serialize()` when the igbinary extension is installed, due to behavior
44+
incompatibilities between the two (performance might be impacted)
1545

1646
Console
1747
-------
@@ -23,7 +53,27 @@ Console
2353
DependencyInjection
2454
-------------------
2555

26-
* Deprecate `!tagged` tag, use `!tagged_iterator` instead
56+
* Deprecate `!tagged` Yaml tag, use `!tagged_iterator` instead
57+
58+
*Before*
59+
```yaml
60+
services:
61+
App\Handler:
62+
tags: ['app.handler']
63+
64+
App\HandlerCollection:
65+
arguments: [!tagged app.handler]
66+
```
67+
68+
*After*
69+
```yaml
70+
services:
71+
App\Handler:
72+
tags: ['app.handler']
73+
74+
App\HandlerCollection:
75+
arguments: [!tagged_iterator app.handler]
76+
```
2777
2878
Form
2979
----
@@ -34,7 +84,8 @@ FrameworkBundle
3484
---------------
3585

3686
* [BC BREAK] The `secrets:decrypt-to-local` command terminates with a non-zero exit code when a secret could not be read
37-
* Deprecate `session.sid_length` and `session.sid_bits_per_character` config options
87+
* Deprecate making `cache.app` adapter taggable, use the `cache.app.taggable` adapter instead
88+
* Deprecate `session.sid_length` and `session.sid_bits_per_character` config options, following the deprecation of these options in PHP 8.4.
3889

3990
HttpFoundation
4091
--------------
@@ -44,8 +95,12 @@ HttpFoundation
4495
Ldap
4596
----
4697

47-
* Add methods for `saslBind()` and `whoami()` to `ConnectionInterface` and `LdapInterface`
48-
* Deprecate the `sizeLimit` option of `AbstractQuery`
98+
* Deprecate the `sizeLimit` option of `AbstractQuery`, the option is unused
99+
100+
Lock
101+
----
102+
103+
* `RedisStore` uses `EVALSHA` over `EVAL` when evaluating LUA scripts
49104

50105
Mailer
51106
------
@@ -55,11 +110,6 @@ Mailer
55110
The `testIncompleteDsnException()` test is no longer provided by default. If you make use of it by implementing the `incompleteDsnProvider()` data providers,
56111
you now need to use the `IncompleteDsnTestTrait`.
57112

58-
Messenger
59-
---------
60-
61-
* Add `getRetryDelay()` method to `RecoverableExceptionInterface`
62-
63113
Notifier
64114
--------
65115

@@ -76,26 +126,17 @@ Routing
76126
Security
77127
--------
78128

79-
* Add `$token` argument to `UserCheckerInterface::checkPostAuth()`
80-
* Deprecate argument `$secret` of `RememberMeToken` and `RememberMeAuthenticator`
129+
* Deprecate argument `$secret` of `RememberMeToken` and `RememberMeAuthenticator`, the argument is unused
81130
* Deprecate passing an empty string as `$userIdentifier` argument to `UserBadge` constructor
82131
* Deprecate returning an empty string in `UserInterface::getUserIdentifier()`
83132

84133
Serializer
85134
----------
86135

87-
* Deprecate the `csv_escape_char` context option of `CsvEncoder` and the `CsvEncoder::ESCAPE_CHAR_KEY` constant
88-
* Deprecate `CsvEncoderContextBuilder::withEscapeChar()` method
136+
* Deprecate the `csv_escape_char` context option of `CsvEncoder`, the `CsvEncoder::ESCAPE_CHAR_KEY` constant
137+
and the `CsvEncoderContextBuilder::withEscapeChar()` method, following its deprecation in PHP 8.4
89138
* Deprecate `AdvancedNameConverterInterface`, use `NameConverterInterface` instead
90139

91-
String
92-
------
93-
94-
* `truncate` method now also accept `TruncateMode` enum instead of a boolean:
95-
* `TruncateMode::Char` is equivalent to `true` value ;
96-
* `TruncateMode::WordAfter` is equivalent to `false` value ;
97-
* `TruncateMode::WordBefore` is a new mode that will cut the sentence on the last word before the limit is reached.
98-
99140
Translation
100141
-----------
101142

@@ -104,7 +145,7 @@ Translation
104145
The `testIncompleteDsnException()` test is no longer provided by default. If you make use of it by implementing the `incompleteDsnProvider()` data providers,
105146
you now need to use the `IncompleteDsnTestTrait`.
106147

107-
* Deprecate passing an escape character to `CsvFileLoader::setCsvControl()`
148+
* Deprecate passing an escape character to `CsvFileLoader::setCsvControl()`, following its deprecation in PHP 8.4
108149

109150
TwigBridge
110151
----------
@@ -123,11 +164,9 @@ TypeInfo
123164
Webhook
124165
-------
125166

126-
* [BC BREAK] `RequestParserInterface::parse()` return type changed from
127-
`?RemoteEvent` to `RemoteEvent|array<RemoteEvent>|null`. Classes already
128-
implementing this interface are unaffected but consumers of this method
129-
will need to be updated to handle the new return type. Projects relying on
130-
the `WebhookController` of the component are not affected by the BC break
167+
* [BC BREAK] `RequestParserInterface::parse()` return type changed from `RemoteEvent|null` to `RemoteEvent|array<RemoteEvent>|null`.
168+
Projects relying on the `WebhookController` of the component are not affected by the BC break. Classes already implementing
169+
this interface are unaffected. Custom callers of this method will need to be updated to handle the extra array return type.
131170

132171
Yaml
133172
----

src/Symfony/Component/Cache/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ CHANGELOG
44
7.2
55
---
66

7-
* `igbinary_serialize()` is not used by default when the igbinary extension is installed
7+
* `igbinary_serialize()` is no longer used instead of `serialize()` by default when the igbinary extension is installed,
8+
due to behavior compatibilities between the two
89
* Add optional `Psr\Clock\ClockInterface` parameter to `ArrayAdapter`
910

1011
7.1

src/Symfony/Component/Ldap/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
---
66

77
* Add methods for `saslBind()` and `whoami()` to `ConnectionInterface` and `LdapInterface`
8-
* Deprecate the `sizeLimit` option of `AbstractQuery`
8+
* Deprecate the `sizeLimit` option of `AbstractQuery`, the option is unused
99

1010
7.1
1111
---

src/Symfony/Component/Mailer/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CHANGELOG
1010
you now need to use the `IncompleteDsnTestTrait`.
1111

1212
* Make `TransportFactoryTestCase` compatible with PHPUnit 10+
13-
* Support unicode email addresses such as "dømi@dømi.fo"
13+
* Support unicode email addresses such as "dømi@dømi.example"
1414

1515
7.1
1616
---

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,18 @@ private function isAllowedProperty(string $class, string $property, bool $writeA
709709
try {
710710
$reflectionProperty = new \ReflectionProperty($class, $property);
711711

712-
if ($writeAccessRequired && $reflectionProperty->isReadOnly()) {
713-
return false;
714-
}
712+
if ($writeAccessRequired) {
713+
if ($reflectionProperty->isReadOnly()) {
714+
return false;
715+
}
716+
717+
if (\PHP_VERSION_ID >= 80400 && ($reflectionProperty->isProtectedSet() || $reflectionProperty->isPrivateSet())) {
718+
return false;
719+
}
715720

716-
if (\PHP_VERSION_ID >= 80400 && $writeAccessRequired && ($reflectionProperty->isProtectedSet() || $reflectionProperty->isPrivateSet())) {
717-
return false;
721+
if (\PHP_VERSION_ID >= 80400 &&$reflectionProperty->isVirtual() && !$reflectionProperty->hasHook(\PropertyHookType::Set)) {
722+
return false;
723+
}
718724
}
719725

720726
return (bool) ($reflectionProperty->getModifiers() & $this->propertyReflectionFlags);
@@ -955,6 +961,20 @@ private function getReadVisiblityForMethod(\ReflectionMethod $reflectionMethod):
955961

956962
private function getWriteVisiblityForProperty(\ReflectionProperty $reflectionProperty): string
957963
{
964+
if (\PHP_VERSION_ID >= 80400) {
965+
if ($reflectionProperty->isVirtual() && !$reflectionProperty->hasHook(\PropertyHookType::Set)) {
966+
return PropertyWriteInfo::VISIBILITY_PRIVATE;
967+
}
968+
969+
if ($reflectionProperty->isPrivateSet()) {
970+
return PropertyWriteInfo::VISIBILITY_PRIVATE;
971+
}
972+
973+
if ($reflectionProperty->isProtectedSet()) {
974+
return PropertyWriteInfo::VISIBILITY_PROTECTED;
975+
}
976+
}
977+
958978
if ($reflectionProperty->isPrivate()) {
959979
return PropertyWriteInfo::VISIBILITY_PRIVATE;
960980
}

src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Symfony\Component\PropertyInfo\Tests\Fixtures\Php81Dummy;
3333
use Symfony\Component\PropertyInfo\Tests\Fixtures\Php82Dummy;
3434
use Symfony\Component\PropertyInfo\Tests\Fixtures\SnakeCaseDummy;
35+
use Symfony\Component\PropertyInfo\Tests\Fixtures\VirtualProperties;
3536
use Symfony\Component\PropertyInfo\Type as LegacyType;
3637
use Symfony\Component\TypeInfo\Type;
3738
use Symfony\Component\TypeInfo\Type\NullableType;
@@ -702,6 +703,69 @@ public function testAsymmetricVisibility()
702703
$this->assertFalse($this->extractor->isWritable(AsymmetricVisibility::class, 'protectedPrivate'));
703704
}
704705

706+
/**
707+
* @requires PHP 8.4
708+
*/
709+
public function testVirtualProperties()
710+
{
711+
$this->assertTrue($this->extractor->isReadable(VirtualProperties::class, 'virtualNoSetHook'));
712+
$this->assertTrue($this->extractor->isReadable(VirtualProperties::class, 'virtualSetHookOnly'));
713+
$this->assertTrue($this->extractor->isReadable(VirtualProperties::class, 'virtualHook'));
714+
$this->assertFalse($this->extractor->isWritable(VirtualProperties::class, 'virtualNoSetHook'));
715+
$this->assertTrue($this->extractor->isWritable(VirtualProperties::class, 'virtualSetHookOnly'));
716+
$this->assertTrue($this->extractor->isWritable(VirtualProperties::class, 'virtualHook'));
717+
}
718+
719+
/**
720+
* @dataProvider provideAsymmetricVisibilityMutator
721+
* @requires PHP 8.4
722+
*/
723+
public function testAsymmetricVisibilityMutator(string $property, string $readVisibility, string $writeVisibility)
724+
{
725+
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PUBLIC | ReflectionExtractor::ALLOW_PROTECTED | ReflectionExtractor::ALLOW_PRIVATE);
726+
$readMutator = $extractor->getReadInfo(AsymmetricVisibility::class, $property);
727+
$writeMutator = $extractor->getWriteInfo(AsymmetricVisibility::class, $property, [
728+
'enable_getter_setter_extraction' => true,
729+
]);
730+
731+
$this->assertSame(PropertyReadInfo::TYPE_PROPERTY, $readMutator->getType());
732+
$this->assertSame(PropertyWriteInfo::TYPE_PROPERTY, $writeMutator->getType());
733+
$this->assertSame($readVisibility, $readMutator->getVisibility());
734+
$this->assertSame($writeVisibility, $writeMutator->getVisibility());
735+
}
736+
737+
public static function provideAsymmetricVisibilityMutator(): iterable
738+
{
739+
yield ['publicPrivate', PropertyReadInfo::VISIBILITY_PUBLIC, PropertyWriteInfo::VISIBILITY_PRIVATE];
740+
yield ['publicProtected', PropertyReadInfo::VISIBILITY_PUBLIC, PropertyWriteInfo::VISIBILITY_PROTECTED];
741+
yield ['protectedPrivate', PropertyReadInfo::VISIBILITY_PROTECTED, PropertyWriteInfo::VISIBILITY_PRIVATE];
742+
}
743+
744+
/**
745+
* @dataProvider provideVirtualPropertiesMutator
746+
* @requires PHP 8.4
747+
*/
748+
public function testVirtualPropertiesMutator(string $property, string $readVisibility, string $writeVisibility)
749+
{
750+
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PUBLIC | ReflectionExtractor::ALLOW_PROTECTED | ReflectionExtractor::ALLOW_PRIVATE);
751+
$readMutator = $extractor->getReadInfo(VirtualProperties::class, $property);
752+
$writeMutator = $extractor->getWriteInfo(VirtualProperties::class, $property, [
753+
'enable_getter_setter_extraction' => true,
754+
]);
755+
756+
$this->assertSame(PropertyReadInfo::TYPE_PROPERTY, $readMutator->getType());
757+
$this->assertSame(PropertyWriteInfo::TYPE_PROPERTY, $writeMutator->getType());
758+
$this->assertSame($readVisibility, $readMutator->getVisibility());
759+
$this->assertSame($writeVisibility, $writeMutator->getVisibility());
760+
}
761+
762+
public static function provideVirtualPropertiesMutator(): iterable
763+
{
764+
yield ['virtualNoSetHook', PropertyReadInfo::VISIBILITY_PUBLIC, PropertyWriteInfo::VISIBILITY_PRIVATE];
765+
yield ['virtualSetHookOnly', PropertyReadInfo::VISIBILITY_PUBLIC, PropertyWriteInfo::VISIBILITY_PUBLIC];
766+
yield ['virtualHook', PropertyReadInfo::VISIBILITY_PUBLIC, PropertyWriteInfo::VISIBILITY_PUBLIC];
767+
}
768+
705769
/**
706770
* @dataProvider typesProvider
707771
*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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\PropertyInfo\Tests\Fixtures;
13+
14+
class VirtualProperties
15+
{
16+
public bool $virtualNoSetHook { get => true; }
17+
public bool $virtualSetHookOnly { set => $value; }
18+
public bool $virtualHook { get => true; set => $value; }
19+
}

src/Symfony/Component/PropertyInfo/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
"conflict": {
3838
"phpdocumentor/reflection-docblock": "<5.2",
3939
"phpdocumentor/type-resolver": "<1.5.1",
40-
"symfony/dependency-injection": "<6.4",
41-
"symfony/serializer": "<6.4"
40+
"symfony/dependency-injection": "<6.4"
4241
},
4342
"autoload": {
4443
"psr-4": { "Symfony\\Component\\PropertyInfo\\": "" },

src/Symfony/Component/Security/Core/Resources/translations/security.zh_CN.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</trans-unit>
7777
<trans-unit id="20">
7878
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
79-
<target state="needs-review-translation">登录尝试失败次数过多,请在 %minutes% 分钟后再试。|登录尝试失败次数过多,请在 %minutes% 分钟后再试。</target>
79+
<target>登录尝试失败次数过多,请在 %minutes% 分钟后重试。</target>
8080
</trans-unit>
8181
</body>
8282
</file>

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ CHANGELOG
44
7.2
55
---
66

7-
* Deprecate the `csv_escape_char` context option of `CsvEncoder` and the `CsvEncoder::ESCAPE_CHAR_KEY` constant
8-
* Deprecate `CsvEncoderContextBuilder::withEscapeChar()` method
7+
* Deprecate the `csv_escape_char` context option of `CsvEncoder`, the `CsvEncoder::ESCAPE_CHAR_KEY` constant
8+
and the `CsvEncoderContextBuilder::withEscapeChar()` method, following its deprecation in PHP 8.4
99
* Add `SnakeCaseToCamelCaseNameConverter`
1010
* Support subclasses of `\DateTime` and `\DateTimeImmutable` for denormalization
1111
* Add the `UidNormalizer::NORMALIZATION_FORMAT_RFC9562` constant

0 commit comments

Comments
 (0)