Skip to content

Commit 44fcbd3

Browse files
Merge branch '4.0'
* 4.0: [DI] Add missing deprecation when fetching private services from ContainerBuilder [FrameworkBundle] Rename getDotEnvVars to getDotenvVars [DI] Fix false-positive circular exception Use a more specific file for detecting the bridge [HttpKernel] Fix issue when resetting DumpDataCollector bumped Symfony version to 4.0.1 updated VERSION for 4.0.0 updated CHANGELOG for 4.0.0 bumped Symfony version to 3.4.1 updated VERSION for 3.4.0 updated CHANGELOG for 3.4.0
2 parents 5b360e2 + 9857419 commit 44fcbd3

File tree

14 files changed

+119
-8
lines changed

14 files changed

+119
-8
lines changed

CHANGELOG-4.0.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@ in 4.0 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/v4.0.0...v4.0.1
99

10+
* 4.0.0 (2017-11-30)
11+
12+
* bug #25220 [HttpFoundation] Add Session::isEmpty(), fix MockFileSessionStorage to behave like the native one (nicolas-grekas)
13+
* bug #25209 [VarDumper] Dont use empty(), it chokes on eg GMP objects (nicolas-grekas)
14+
* bug #25200 [HttpKernel] Arrays with scalar values passed to ESI fragment renderer throw deprecation notice (Simperfit)
15+
* bug #25201 [HttpKernel] Add a better error messages when passing a private or non-tagged controller (Simperfit)
16+
* bug #25155 [DependencyInjection] Detect case mismatch in autowiring (Simperfit, sroze)
17+
* bug #25217 [Dotenv] Changed preg_match flags from null to 0 (deekthesqueak)
18+
* bug #25180 [DI] Fix circular reference when using setters (nicolas-grekas)
19+
* bug #25204 [DI] Clear service reference graph (nicolas-grekas)
20+
* bug #25203 [DI] Fix infinite loop in InlineServiceDefinitionsPass (nicolas-grekas)
21+
* bug #25185 [Serializer] Do not cache attributes if `attributes` in context (sroze)
22+
* bug #25190 [HttpKernel] Keep legacy container files for concurrent requests (nicolas-grekas)
23+
* bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new flashes (Simperfit, sroze)
24+
* bug #25174 [Translation] modify definitions only if the do exist (xabbuh)
25+
* bug #25179 [FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed (ogizanagi)
26+
* bug #25160 [DI] Prevent a ReflectionException during cache:clear when the parent class doesn't exist (dunglas)
27+
* bug #25163 [DI] Fix tracking of env vars in exceptions (nicolas-grekas)
28+
* bug #25162 [HttpKernel] Read $_ENV when checking SHELL_VERBOSITY (nicolas-grekas)
29+
* bug #25158 [DI] Remove unreachable code (GawainLynch)
30+
* bug #25152 [Form] Don't rely on `Symfony\Component\HttpFoundation\File\File` if http-foundation isn't in FileType (issei-m)
31+
* bug #24987 [Console] Fix global console flag when used in chain (Simperfit)
32+
* bug #25137 Adding checks for the expression language (weaverryan)
33+
* bug #25151 [FrameworkBundle] Automatically enable the CSRF protection if CSRF manager exists (sroze)
34+
* bug #25043 [Yaml] added ability for substitute aliases when mapping is on single line (Michał Strzelecki, xabbuh)
35+
1036
* 4.0.0-RC2 (2017-11-24)
1137

1238
* bug #25146 [DI] Dont resolve envs in service ids (nicolas-grekas)

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (PHP_VERSION_ID >= 70200) {
2727
}
2828

2929
$root = __DIR__;
30-
while (!file_exists($root.'/composer.json') || file_exists($root.'/bin/simple-phpunit')) {
30+
while (!file_exists($root.'/composer.json') || file_exists($root.'/DeprecationErrorHandler.php')) {
3131
if ($root === dirname($root)) {
3232
break;
3333
}

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9090
array('Xdebug', extension_loaded('xdebug') ? 'true' : 'false'),
9191
);
9292

93-
if ($dotenv = self::getDotEnvVars()) {
93+
if ($dotenv = self::getDotenvVars()) {
9494
$rows = array_merge($rows, array(
9595
new TableSeparator(),
9696
array('<info>Environment (.env)</>'),
@@ -129,7 +129,7 @@ private static function isExpired(string $date): bool
129129
return false !== $date && new \DateTime() > $date->modify('last day of this month 23:59:59');
130130
}
131131

132-
private static function getDotEnvVars(): array
132+
private static function getDotenvVars(): array
133133
{
134134
$vars = array();
135135
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,10 @@ public function testStopwatchExtensionAvailability($debug, $stopwatchEnabled, $e
218218
}
219219
$container->registerExtension(new TwigExtension());
220220
$container->loadFromExtension('twig', array());
221+
$container->setAlias('test.twig.extension.debug.stopwatch', 'twig.extension.debug.stopwatch')->setPublic(true);
221222
$this->compileContainer($container);
222223

223-
$tokenParsers = $container->get('twig.extension.debug.stopwatch')->getTokenParsers();
224+
$tokenParsers = $container->get('test.twig.extension.debug.stopwatch')->getTokenParsers();
224225
$stopwatchIsAvailable = new \ReflectionProperty($tokenParsers[0], 'stopwatchIsAvailable');
225226
$stopwatchIsAvailable->setAccessible(true);
226227

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ public function has($id)
519519
*/
520520
public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
521521
{
522+
if ($this->isCompiled() && isset($this->removedIds[$id]) && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) {
523+
return parent::get($id);
524+
}
525+
522526
return $this->doGet($id, $invalidBehavior);
523527
}
524528

@@ -715,6 +719,12 @@ public function compile(bool $resolveEnvPlaceholders = false)
715719
}
716720

717721
parent::compile();
722+
723+
foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) {
724+
if (!$definition->isPublic() || $definition->isPrivate()) {
725+
$this->removedIds[$id] = true;
726+
}
727+
}
718728
}
719729

720730
/**

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ private function addServiceInlinedDefinitions(string $id, Definition $definition
472472
// $b = new ServiceB();
473473
// $a = new ServiceA(ServiceB $b);
474474
// $b->setServiceA(ServiceA $a);
475-
if ($this->hasReference($id, array($def->getArguments(), $def->getFactory()))) {
475+
if (isset($inlinedDefinition[$definition]) && $this->hasReference($id, array($def->getArguments(), $def->getFactory()))) {
476476
throw new ServiceCircularReferenceException($id, array($id));
477477
}
478478

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ public function testEnvInId()
733733
PsrContainerInterface::class => true,
734734
ContainerInterface::class => true,
735735
'baz_%env(BAR)%' => true,
736+
'bar_%env(BAR)%' => true,
736737
);
737738
$this->assertSame($expected, $container->getRemovedIds());
738739

@@ -1237,6 +1238,9 @@ public function testAlmostCircular($visibility)
12371238
$this->assertSame($foo2, $foo2->bar->foobar->foo);
12381239

12391240
$this->assertSame(array(), (array) $container->get('foobar4'));
1241+
1242+
$foo5 = $container->get('foo5');
1243+
$this->assertSame($foo5, $foo5->bar->foo);
12401244
}
12411245

12421246
public function provideAlmostCircular()

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,9 @@ public function testAlmostCircular($visibility)
781781
$this->assertSame($foo2, $foo2->bar->foobar->foo);
782782

783783
$this->assertSame(array(), (array) $container->get('foobar4'));
784+
785+
$foo5 = $container->get('foo5');
786+
$this->assertSame($foo5, $foo5->bar->foo);
784787
}
785788

786789
public function provideAlmostCircular()

src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_almost_circular.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,13 @@
4646
$container->register('foobar4', 'stdClass')->setPublic(true)
4747
->addArgument(new Reference('foo4'));
4848

49+
// loop on the constructor of a setter-injected dep with property
50+
51+
$container->register('foo5', 'stdClass')->setPublic(true)
52+
->setProperty('bar', new Reference('bar5'));
53+
54+
$container->register('bar5', 'stdClass')->setPublic($public)
55+
->addArgument(new Reference('foo5'))
56+
->setProperty('foo', new Reference('foo5'));
57+
4958
return $container;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function __construct()
2828
'bar3' => 'getBar3Service',
2929
'foo' => 'getFooService',
3030
'foo2' => 'getFoo2Service',
31+
'foo5' => 'getFoo5Service',
3132
'foobar4' => 'getFoobar4Service',
3233
);
3334

@@ -56,6 +57,7 @@ public function getRemovedIds()
5657
'Psr\\Container\\ContainerInterface' => true,
5758
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
5859
'bar' => true,
60+
'bar5' => true,
5961
'foo4' => true,
6062
'foobar' => true,
6163
'foobar2' => true,
@@ -125,6 +127,24 @@ protected function getFoo2Service()
125127
return $this->services['foo2'] = new \FooCircular($a);
126128
}
127129

130+
/**
131+
* Gets the public 'foo5' shared service.
132+
*
133+
* @return \stdClass
134+
*/
135+
protected function getFoo5Service()
136+
{
137+
$this->services['foo5'] = $instance = new \stdClass();
138+
139+
$a = new \stdClass(($this->services['foo5'] ?? $this->getFoo5Service()));
140+
141+
$a->foo = $instance;
142+
143+
$instance->bar = $a;
144+
145+
return $instance;
146+
}
147+
128148
/**
129149
* Gets the public 'foobar4' shared service.
130150
*

0 commit comments

Comments
 (0)