Skip to content

Commit 09dff04

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: [Console] minor fix [Command] fix emojis messing up the line width [Validator] Avoid triggering the autoloader for user-input values Hardening Security - Unserialize DumpDataCollector Security hardening - Rate limiter [FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized Fixed parsing deprecated definitions without message key improve login throttling rate limiter requirement message [HttpClient] remove using $http_response_header [Security] Handle properly 'auto' option for remember me cookie security
2 parents 8d7e2e3 + 1e66194 commit 09dff04

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

Loader/YamlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ private function parseDefinition(string $id, $service, string $file, array $defa
433433
trigger_deprecation('symfony/dependency-injection', '5.1', 'Not setting the attribute "version" of the "deprecated" option in "%s" is deprecated.', $file);
434434
}
435435

436-
$alias->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message']);
436+
$alias->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message'] ?? '');
437437
}
438438
}
439439

@@ -504,7 +504,7 @@ private function parseDefinition(string $id, $service, string $file, array $defa
504504
trigger_deprecation('symfony/dependency-injection', '5.1', 'Not setting the attribute "version" of the "deprecated" option in "%s" is deprecated.', $file);
505505
}
506506

507-
$definition->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message']);
507+
$definition->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message'] ?? '');
508508
}
509509

510510
if (isset($service['factory'])) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
service_without_deprecation_message:
3+
class: Foo
4+
deprecated:
5+
package: vendor/package
6+
version: 1.1
7+
8+
alias_without_deprecation_message:
9+
alias: foobar
10+
deprecated:
11+
package: vendor/package
12+
version: 1.1

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,27 @@ public function testLoadShortSyntax()
220220
$this->assertSame(['$a' => 'a', 'App\Foo' => 'foo'], $services['bar_foo']->getArguments());
221221
}
222222

223+
public function testLoadDeprecatedDefinitionWithoutMessageKey()
224+
{
225+
$container = new ContainerBuilder();
226+
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
227+
$loader->load('deprecated_definition_without_message.yml');
228+
229+
$this->assertTrue($container->getDefinition('service_without_deprecation_message')->isDeprecated());
230+
$deprecation = $container->getDefinition('service_without_deprecation_message')->getDeprecation('service_without_deprecation_message');
231+
$message = 'The "service_without_deprecation_message" service is deprecated. You should stop using it, as it will be removed in the future.';
232+
$this->assertSame($message, $deprecation['message']);
233+
$this->assertSame('vendor/package', $deprecation['package']);
234+
$this->assertSame('1.1', $deprecation['version']);
235+
236+
$this->assertTrue($container->getAlias('alias_without_deprecation_message')->isDeprecated());
237+
$deprecation = $container->getAlias('alias_without_deprecation_message')->getDeprecation('alias_without_deprecation_message');
238+
$message = 'The "alias_without_deprecation_message" service alias is deprecated. You should stop using it, as it will be removed in the future.';
239+
$this->assertSame($message, $deprecation['message']);
240+
$this->assertSame('vendor/package', $deprecation['package']);
241+
$this->assertSame('1.1', $deprecation['version']);
242+
}
243+
223244
public function testDeprecatedAliases()
224245
{
225246
$container = new ContainerBuilder();

0 commit comments

Comments
 (0)