Skip to content

Commit f581151

Browse files
Merge branch '6.4' into 7.0
* 6.4: [AssetMapper] Fixing js sourceMappingURL extraction when sourceMappingURL used in code [VarExporter] Deprecate per-property lazy-initializers [Routing] Extend old Annotations from new Attributes [Mailer] Update default Mailjet port Bump Symfony version to 6.4.0 Update VERSION for 6.4.0-BETA3 Update CHANGELOG for 6.4.0-BETA3
2 parents 21673dc + 8f7cb63 commit f581151

File tree

26 files changed

+128
-44
lines changed

26 files changed

+128
-44
lines changed

CHANGELOG-6.4.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,44 @@ in 6.4 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.4.0...v6.4.1
99

10+
* 6.4.0-BETA3 (2023-11-10)
11+
12+
* bug #51666 [RateLimiter] CompoundLimiter was accepting requests even when some limiters already consumed all tokens (10n)
13+
* bug #52524 [AssetMapper] Only download a CSS file if it is explicitly advertised (weaverryan)
14+
* bug #52523 [AssetMapper] avoid caching MappedAsset inside JavaScript Import (weaverryan)
15+
* bug #52519 [AssetMapper] If assets are served from a subdirectory or CDN, also adjust importmap keys (weaverryan)
16+
* bug #52508 [AssetMapper] Fix jsdelivr import parsing with no imported value (weaverryan)
17+
* security #cve-2023-46734 [TwigBridge] Ensure CodeExtension's filters properly escape their input (nicolas-grekas, GromNaN)
18+
* security #cve-2023-46735 [Webhook] Remove user-submitted type from HTTP response (nicolas-grekas)
19+
* security #cve-2023-46733 [Security] Fix possible session fixation when only the *token* changes (RobertMe)
20+
* bug #52514 [FrameworkBundle] Don't reference SYMFONY_IDE env var in non-debug mode (nicolas-grekas)
21+
* bug #52506 [SecurityBundle] wire the secret for Symfony 6.4 compatibility (xabbuh)
22+
* bug #52496 [VarDumper] Accept mixed key on `DsPairStub` (marc-mabe)
23+
* bug #52502 [Config] Prefixing `FileExistenceResource::__toString()` to avoid conflict with `FileResource` (weaverryan)
24+
* bug #52491 [String] Method toByteString conversion using iconv is unreachable (Vincentv92)
25+
* bug #52488 [HttpKernel] Fix PHP deprecation (nicolas-grekas)
26+
* bug #52469 Check whether secrets are empty and mark them all as sensitive (nicolas-grekas)
27+
* feature #52471 [HttpKernel] Add `ControllerResolver::allowControllers()` to define which callables are legit controllers when the `_check_controller_is_allowed` request attribute is set (nicolas-grekas)
28+
* bug #52476 [Messenger] fix compatibility with Doctrine DBAL 4 (xabbuh)
29+
* bug #52434 [Console][FrameworkBundle] Fix missing `profile` option for console commands (keulinho)
30+
* bug #52474 [HttpFoundation] ensure string type with mbstring func overloading enabled (xabbuh)
31+
* bug #52472 [HttpClient][WebProfilerBundle] Do not generate cURL command when files are uploaded (MatTheCat)
32+
* bug #52457 [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL (HypeMC)
33+
* bug #52443 [Yaml] Fix uid binary parsing (mRoca)
34+
* feature #52449 [TwigBridge] Mark CodeExtension as `@internal` (fabpot)
35+
* bug #52429 [HttpClient] Replace `escapeshellarg` to prevent overpassing `ARG_MAX` (alexandre-daubois)
36+
* bug #52442 Disable the "Copy as cURL" button when the debug info are disabled (stof)
37+
* bug #52444 Remove full DSNs from exception messages (nicolas-grekas)
38+
* feature #52336 [HttpFoundation][Lock] Makes MongoDB adapters usable with `ext-mongodb` only (GromNaN)
39+
* bug #52428 [HttpKernel] Preventing error 500 when function putenv is disabled (ShaiMagal)
40+
* bug #52427 [Console][Process] do not let context classes extend the message classes (xabbuh)
41+
* bug #52408 [Yaml] Fix block scalar array parsing (NickSdot)
42+
* bug #52132 [Console] Fix horizontal table top border is incorrectly rendered (OskarStark)
43+
* bug #52368 [AssetMapper] Fixing bug where JSCompiler used non-absolute importmap entry path (weaverryan)
44+
* bug #52367 [Uid] Fix UuidV7 collisions within the same ms (nicolas-grekas)
45+
* bug #52287 [FrameworkBundle] Fix deprecation layer for "enable_annotations" in validation and serializer configuration (lyrixx)
46+
* bug #52222 [MonologBridge] Fix support for monolog 3.0 (louismariegaborit)
47+
1048
* 6.4.0-BETA2 (2023-10-29)
1149

1250
* bug #52329 [HttpClient] Psr18Client: parse HTTP Reason Phrase for Response (Hanmac)

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ private function makeImportsBare(string $content, array &$dependencies): string
248248
}, $content);
249249

250250
// source maps are not also downloaded - so remove the sourceMappingURL
251-
$content = preg_replace('{//# sourceMappingURL=.*$}m', '', $content);
251+
// remove the final one only (in case sourceMappingURL is used in the code)
252+
if (false !== $lastPos = strrpos($content, '//# sourceMappingURL=')) {
253+
$content = substr($content, 0, $lastPos).preg_replace('{//# sourceMappingURL=.*$}m', '', substr($content, $lastPos));
254+
}
252255

253256
return preg_replace('{/\*# sourceMappingURL=[^ ]*+ \*/}', '', $content);
254257
}

src/Symfony/Component/AssetMapper/Tests/ImportMap/Resolver/JsDelivrEsmResolverTest.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,30 @@ public static function provideDownloadPackagesTests()
430430
],
431431
];
432432

433-
yield 'css file removes importmap' => [
433+
yield 'js sourcemap is correctly removed when sourceMapping appears in the JS' => [
434+
[
435+
'es-module-shims' => self::createRemoteEntry('es-module-shims', version: '1.8.2'),
436+
],
437+
[
438+
[
439+
'url' => '/es-module-shims@1.8.2/+esm',
440+
'body' => <<<'EOF'
441+
const je="\n//# sourceURL=",Ue="\n//# sourceMappingURL=",Me=/^(text|application)\/(x-)?javascript(;|$)/,_e=/^(application)\/wasm(;|$)/,Ie=/^(text|application)\/json(;|$)/,Re=/^(text|application)\/css(;|$)/,Te=/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;export{t as default};
442+
//# sourceMappingURL=/sm/ef3916de598f421a779ba0e69af94655b2043095cde2410cc01893452d893338.map
443+
EOF
444+
],
445+
],
446+
[
447+
'es-module-shims' => [
448+
'content' => <<<'EOF'
449+
const je="\n//# sourceURL=",Ue="\n//# sourceMappingURL=",Me=/^(text|application)\/(x-)?javascript(;|$)/,_e=/^(application)\/wasm(;|$)/,Ie=/^(text|application)\/json(;|$)/,Re=/^(text|application)\/css(;|$)/,Te=/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;export{t as default};
450+
EOF,
451+
'dependencies' => [],
452+
],
453+
],
454+
];
455+
456+
yield 'css file removes sourcemap' => [
434457
['lodash' => self::createRemoteEntry('bootstrap/dist/bootstrap.css', version: '5.0.6', type: ImportMapType::CSS)],
435458
[
436459
[

src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetSmtpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MailjetSmtpTransport extends EsmtpTransport
1919
{
2020
public function __construct(string $username, #[\SensitiveParameter] string $password, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
2121
{
22-
parent::__construct('in-v3.mailjet.com', 465, true, $dispatcher, $logger);
22+
parent::__construct('in-v3.mailjet.com', 587, true, $dispatcher, $logger);
2323

2424
$this->setUsername($username);
2525
$this->setPassword($password);

src/Symfony/Component/Mailer/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CHANGELOG
1010
---
1111

1212
* Add DSN parameter `peer_fingerprint` to verify TLS certificate fingerprint
13+
* Change the default port for the `mailjet+smtp` transport from 465 to 587
1314

1415
6.3
1516
---

src/Symfony/Component/Routing/Annotation/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class_exists(\Symfony\Component\Routing\Attribute\Route::class);
1717

1818
if (false) {
1919
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
20-
class Route
20+
class Route extends \Symfony\Component\Routing\Attribute\Route
2121
{
2222
}
2323
}

src/Symfony/Component/Routing/Attribute/Route.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/**
1515
* @author Fabien Potencier <fabien@symfony.com>
1616
* @author Alexander M. Turek <me@derrabus.de>
17+
*
18+
* @final since Symfony 6.4
1719
*/
1820
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
1921
class Route

src/Symfony/Component/Serializer/Annotation/Context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\Context::class);
1717

1818
if (false) {
1919
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
20-
class Context
20+
class Context extends \Symfony\Component\Serializer\Attribute\Context
2121
{
2222
}
2323
}

src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\DiscriminatorMap::class);
1515

1616
if (false) {
1717
#[\Attribute(\Attribute::TARGET_CLASS)]
18-
class DiscriminatorMap
18+
class DiscriminatorMap extends \Symfony\Component\Serializer\Attribute\DiscriminatorMap
1919
{
2020
}
2121
}

src/Symfony/Component/Serializer/Annotation/Groups.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\Groups::class);
1515

1616
if (false) {
1717
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_CLASS)]
18-
class Groups
18+
class Groups extends \Symfony\Component\Serializer\Attribute\Groups
1919
{
2020
}
2121
}

src/Symfony/Component/Serializer/Annotation/Ignore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\Ignore::class);
1515

1616
if (false) {
1717
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
18-
final class Ignore
18+
class Ignore extends \Symfony\Component\Serializer\Attribute\Ignore
1919
{
2020
}
2121
}

src/Symfony/Component/Serializer/Annotation/MaxDepth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\MaxDepth::class);
1515

1616
if (false) {
1717
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
18-
class MaxDepth
18+
class MaxDepth extends \Symfony\Component\Serializer\Attribute\MaxDepth
1919
{
2020
}
2121
}

src/Symfony/Component/Serializer/Annotation/SerializedName.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\SerializedName::class);
1515

1616
if (false) {
1717
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
18-
final class SerializedName
18+
class SerializedName extends \Symfony\Component\Serializer\Attribute\SerializedName
1919
{
2020
}
2121
}

src/Symfony/Component/Serializer/Annotation/SerializedPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class_exists(\Symfony\Component\Serializer\Attribute\SerializedPath::class);
1515

1616
if (false) {
1717
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
18-
final class SerializedPath
18+
class SerializedPath extends \Symfony\Component\Serializer\Attribute\SerializedPath
1919
{
2020
}
2121
}

src/Symfony/Component/Serializer/Attribute/Context.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
18+
*
19+
* @final since Symfony 6.4
1820
*/
1921
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
2022
class Context

src/Symfony/Component/Serializer/Attribute/DiscriminatorMap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* @author Samuel Roze <samuel.roze@gmail.com>
18+
*
19+
* @final since Symfony 6.4
1820
*/
1921
#[\Attribute(\Attribute::TARGET_CLASS)]
2022
class DiscriminatorMap

src/Symfony/Component/Serializer/Attribute/Groups.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* @author Kévin Dunglas <dunglas@gmail.com>
18+
*
19+
* @final since Symfony 6.4
1820
*/
1921
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_CLASS)]
2022
class Groups

src/Symfony/Component/Serializer/Attribute/Ignore.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
/**
1515
* @author Kévin Dunglas <dunglas@gmail.com>
16+
*
17+
* @final since Symfony 6.4
1618
*/
1719
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
18-
final class Ignore
20+
class Ignore
1921
{
2022
}
2123

src/Symfony/Component/Serializer/Attribute/MaxDepth.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* @author Kévin Dunglas <dunglas@gmail.com>
18+
*
19+
* @final since Symfony 6.4
1820
*/
1921
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
2022
class MaxDepth

src/Symfony/Component/Serializer/Attribute/SerializedName.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515

1616
/**
1717
* @author Fabien Bourigault <bourigaultfabien@gmail.com>
18+
*
19+
* @final since Symfony 6.4
1820
*/
1921
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
20-
final class SerializedName
22+
class SerializedName
2123
{
2224
public function __construct(private readonly string $serializedName)
2325
{

src/Symfony/Component/Serializer/Attribute/SerializedPath.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
/**
1919
* @author Tobias Bönner <tobi@boenner.family>
20+
*
21+
* @final since Symfony 6.4
2022
*/
2123
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
22-
final class SerializedPath
24+
class SerializedPath
2325
{
2426
private PropertyPath $serializedPath;
2527

src/Symfony/Component/VarExporter/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.4
5+
---
6+
7+
* Deprecate per-property lazy-initializers
8+
49
6.2
510
---
611

src/Symfony/Component/VarExporter/LazyGhostTrait.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,20 @@ trait LazyGhostTrait
2323
/**
2424
* Creates a lazy-loading ghost instance.
2525
*
26-
* When the initializer is a closure, it should initialize all properties at
27-
* once and is given the instance to initialize as argument.
28-
*
29-
* When the initializer is an array of closures, it should be indexed by
30-
* properties and closures should accept 4 arguments: the instance to
31-
* initialize, the property to initialize, its write-scope, and its default
32-
* value. Each closure should return the value of the corresponding property.
33-
* The special "\0" key can be used to define a closure that returns all
34-
* properties at once when full-initialization is needed; it takes the
35-
* instance and its default properties as arguments.
36-
*
37-
* Properties should be indexed by their array-cast name, see
26+
* Skipped properties should be indexed by their array-cast identifier, see
3827
* https://php.net/manual/language.types.array#language.types.array.casting
3928
*
40-
* @param (\Closure(static):void
41-
* |array<string, \Closure(static, string, ?string, mixed):mixed>
42-
* |array{"\0": \Closure(static, array<string, mixed>):array<string, mixed>}) $initializer
43-
* @param array<string, true>|null $skippedProperties An array indexed by the properties to skip, aka the ones
44-
* that the initializer doesn't set when its a closure
29+
* @param (\Closure(static):void $initializer The closure should initialize the object it receives as argument
30+
* @param array<string, true>|null $skippedProperties An array indexed by the properties to skip, a.k.a. the ones
31+
* that the initializer doesn't initialize, if any
4532
* @param static|null $instance
4633
*/
4734
public static function createLazyGhost(\Closure|array $initializer, array $skippedProperties = null, object $instance = null): static
4835
{
36+
if (\is_array($initializer)) {
37+
trigger_deprecation('symfony/var-exporter', '6.4', 'Per-property lazy-initializers are deprecated and won\'t be supported anymore in 7.0, use an object initializer instead.');
38+
}
39+
4940
$onlyProperties = null === $skippedProperties && \is_array($initializer) ? $initializer : null;
5041

5142
if (self::class !== $class = $instance ? $instance::class : static::class) {

src/Symfony/Component/VarExporter/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,6 @@ $foo = FooLazyGhost::createLazyGhost(initializer: function (Foo $instance): void
105105
// be called only when and if a *property* is accessed.
106106
```
107107

108-
You can also partially initialize the objects on a property-by-property basis by
109-
adding two arguments to the initializer:
110-
111-
```php
112-
$initializer = function (Foo $instance, string $propertyName, ?string $propertyScope): mixed {
113-
if (Foo::class === $propertyScope && 'bar' === $propertyName) {
114-
return 123;
115-
}
116-
// [...] Add more logic for the other properties
117-
};
118-
```
119-
120108
### `LazyProxyTrait`
121109

122110
Alternatively, `LazyProxyTrait` can be used to create virtual proxies:

src/Symfony/Component/VarExporter/Tests/LazyGhostTraitTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ public function testFullInitialization()
186186
$this->assertSame(1, $counter);
187187
}
188188

189+
/**
190+
* @group legacy
191+
*/
189192
public function testPartialInitialization()
190193
{
191194
$counter = 0;
@@ -243,6 +246,9 @@ public function testPartialInitialization()
243246
$this->assertSame([123, 345, 456, 567, 234, 678], array_values($properties));
244247
}
245248

249+
/**
250+
* @group legacy
251+
*/
246252
public function testPartialInitializationWithReset()
247253
{
248254
$initializer = static fn (ChildTestClass $instance, string $property, ?string $scope, mixed $default) => 234;
@@ -275,6 +281,9 @@ public function testPartialInitializationWithReset()
275281
$this->assertSame(234, $instance->public);
276282
}
277283

284+
/**
285+
* @group legacy
286+
*/
278287
public function testPartialInitializationWithNastyPassByRef()
279288
{
280289
$instance = ChildTestClass::createLazyGhost(['public' => fn (ChildTestClass $instance, string &$property, ?string &$scope, mixed $default) => $property = $scope = 123]);
@@ -307,6 +316,9 @@ public function testReflectionPropertyGetValue()
307316
$this->assertSame(-3, $r->getValue($obj));
308317
}
309318

319+
/**
320+
* @group legacy
321+
*/
310322
public function testFullPartialInitialization()
311323
{
312324
$counter = 0;
@@ -335,6 +347,9 @@ public function testFullPartialInitialization()
335347
$this->assertSame(1000, $counter);
336348
}
337349

350+
/**
351+
* @group legacy
352+
*/
338353
public function testPartialInitializationFallback()
339354
{
340355
$counter = 0;
@@ -357,6 +372,9 @@ public function testPartialInitializationFallback()
357372
$this->assertSame(1000, $counter);
358373
}
359374

375+
/**
376+
* @group legacy
377+
*/
360378
public function testFullInitializationAfterPartialInitialization()
361379
{
362380
$counter = 0;

0 commit comments

Comments
 (0)