Skip to content

Commit 7c875c8

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: (25 commits) [2.6] link to https://symfony.com where possible Do not override PHP constants, only use when available link to https://symfony.com where possible [FrameworkBundle] Added missing log in server:run command [Finder] Only use GLOB_BRACE when available [HttpFoundation] Allow curly braces in trusted host patterns Fix merge Fix typo in variable name [profiler][security] check authenticated user by tokenClass instead of username. [WebProfiler] fix html syntax for input types [TwigBundle] Fix deprecated use of FlattenException [DependencyInjection] Removed extra strtolower calls Use https://symfony.com/search for searching [Debug] PHP7 compatibility with BaseException [Validator] Fixed Choice when an empty array is used in the "choices" option Fixed tests [StringUtil] Fixed singularification of 'selfies' Fix Portuguese (Portugal) translation for Security improved exception when missing required component [DependencyInjection] resolve circular reference ... Conflicts: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig src/Symfony/Component/Form/README.md src/Symfony/Component/Intl/README.md src/Symfony/Component/Security/README.md src/Symfony/Component/Translation/README.md src/Symfony/Component/Validator/README.md
2 parents 2a5515a + b575c16 commit 7c875c8

File tree

8 files changed

+17
-22
lines changed

8 files changed

+17
-22
lines changed

Container.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ class Container implements IntrospectableContainerInterface
8686
public function __construct(ParameterBagInterface $parameterBag = null)
8787
{
8888
$this->parameterBag = $parameterBag ?: new ParameterBag();
89-
90-
$this->set('service_container', $this);
9189
}
9290

9391
/**

ContainerBuilder.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
470470
return $service;
471471
}
472472

473-
if (!$this->hasDefinition($id) && isset($this->aliasDefinitions[$id])) {
473+
if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
474474
return $this->get($this->aliasDefinitions[$id]);
475475
}
476476

@@ -684,7 +684,7 @@ public function setAlias($alias, $id)
684684
throw new InvalidArgumentException('$id must be a string, or an Alias object.');
685685
}
686686

687-
if ($alias === strtolower($id)) {
687+
if ($alias === (string) $id) {
688688
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
689689
}
690690

@@ -746,7 +746,7 @@ public function getAlias($id)
746746
{
747747
$id = strtolower($id);
748748

749-
if (!$this->hasAlias($id)) {
749+
if (!isset($this->aliasDefinitions[$id])) {
750750
throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id));
751751
}
752752

@@ -864,7 +864,7 @@ public function getDefinition($id)
864864
{
865865
$id = strtolower($id);
866866

867-
if (!$this->hasDefinition($id)) {
867+
if (!array_key_exists($id, $this->definitions)) {
868868
throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id));
869869
}
870870

@@ -886,8 +886,10 @@ public function getDefinition($id)
886886
*/
887887
public function findDefinition($id)
888888
{
889-
while ($this->hasAlias($id)) {
890-
$id = (string) $this->getAlias($id);
889+
$id = strtolower($id);
890+
891+
while (isset($this->aliasDefinitions[$id])) {
892+
$id = (string) $this->aliasDefinitions[$id];
891893
}
892894

893895
return $this->getDefinition($id);

Dumper/PhpDumper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,6 @@ public function __construct()
904904
\$this->services =
905905
\$this->scopedServices =
906906
\$this->scopeStacks = array();
907-
908-
\$this->set('service_container', \$this);
909-
910907
EOF;
911908

912909
$code .= "\n";

Tests/ContainerBuilderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ public function testAliases()
190190
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
191191
$this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
192192

193+
try {
194+
$builder->setAlias('foobar', 'foobar');
195+
$this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself');
196+
} catch (\InvalidArgumentException $e) {
197+
$this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself');
198+
}
199+
193200
try {
194201
$builder->getAlias('foobar');
195202
$this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist');

Tests/Fixtures/php/services10.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public function __construct()
2929
$this->services =
3030
$this->scopedServices =
3131
$this->scopeStacks = array();
32-
33-
$this->set('service_container', $this);
34-
3532
$this->scopes = array();
3633
$this->scopeChildren = array();
3734
$this->methodMap = array(

Tests/Fixtures/php/services12.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public function __construct()
3333
$this->services =
3434
$this->scopedServices =
3535
$this->scopeStacks = array();
36-
37-
$this->set('service_container', $this);
38-
3936
$this->scopes = array();
4037
$this->scopeChildren = array();
4138
$this->methodMap = array(

Tests/Fixtures/php/services9_compiled.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public function __construct()
2929
$this->services =
3030
$this->scopedServices =
3131
$this->scopeStacks = array();
32-
33-
$this->set('service_container', $this);
34-
3532
$this->scopes = array();
3633
$this->scopeChildren = array();
3734
$this->methodMap = array(

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Symfony DependencyInjection Component",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

0 commit comments

Comments
 (0)