Skip to content

Commit 1cada24

Browse files
committed
Merge branch '4.0'
* 4.0: [HttpKernel] Better handling of legacy cache modify definitions only if the do exist [DI] Prevent a ReflectionException during cache:clear when the parent class doesn't exist [FrameworkBundle] Make MicroKernelTraitTest green don't override existing verbosity env var [HttpKernel] Read $_ENV when checking SHELL_VERBOSITY Remove unreachable code bumped Symfony version to 4.0.0 Automatically enable the CSRF protection if CSRF manager exists updated VERSION for 4.0.0-RC2 updated CHANGELOG for 4.0.0-RC2 bumped Symfony version to 3.4.0 adding checks for the expression language updated VERSION for 3.4.0-RC2 updated CHANGELOG for 3.4.0-RC2
2 parents 22192b1 + d2496ab commit 1cada24

File tree

13 files changed

+66
-16
lines changed

13 files changed

+66
-16
lines changed

CHANGELOG-4.0.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ 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-RC2 (2017-11-24)
11+
12+
* bug #25146 [DI] Dont resolve envs in service ids (nicolas-grekas)
13+
* bug #25113 [Routing] Fix "config-file-relative" annotation loader resources (nicolas-grekas, sroze)
14+
* bug #25065 [FrameworkBundle] Update translation commands to work with default paths (yceruto)
15+
* bug #25109 Make debug:container search command case-insensitive (jzawadzki)
16+
* bug #25121 [FrameworkBundle] Fix AssetsInstallCommand (nicolas-grekas)
17+
* bug #25102 [Form] Fixed ContextErrorException in FileType (chihiro-adachi)
18+
* bug #25130 [DI] Fix handling of inlined definitions by ContainerBuilder (nicolas-grekas)
19+
* bug #25119 [DI] Fix infinite loop when analyzing references (nicolas-grekas)
20+
* bug #25094 [FrameworkBundle][DX] Display a nice error message if an enabled component is missing (derrabus)
21+
* bug #25100 [SecurityBundle] providerIds is undefined error when firewall provider is not specified (karser)
22+
* bug #25100 [SecurityBundle] providerIds is undefined error when firewall provider is not specified (karser)
23+
* bug #25100 [SecurityBundle] providerIds is undefined error when firewall provider is not specified (karser)
24+
* bug #25097 [Bridge\PhpUnit] Turn "preserveGlobalState" to false by default, revert "Blacklist" removal (nicolas-grekas)
25+
1026
* 4.0.0-RC1 (2017-11-21)
1127

1228
* bug #25077 [Bridge/Twig] Let getFlashes starts the session (MatTheCat)

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\Form\Form;
2222
use Symfony\Component\Lock\Lock;
2323
use Symfony\Component\Lock\Store\SemaphoreStore;
24+
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
2425
use Symfony\Component\Serializer\Serializer;
2526
use Symfony\Component\Translation\Translator;
2627
use Symfony\Component\Validator\Validation;
@@ -109,7 +110,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
109110
$rootNode
110111
->children()
111112
->arrayNode('csrf_protection')
112-
->canBeEnabled()
113+
->{!class_exists(FullStack::class) && class_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
113114
->end()
114115
->end()
115116
;

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MicroKernelTraitTest extends TestCase
1818
{
1919
public function test()
2020
{
21-
$kernel = new ConcreteMicroKernel('test', true);
21+
$kernel = new ConcreteMicroKernel('test', false);
2222
$kernel->boot();
2323

2424
$request = Request::create('/');
@@ -31,7 +31,7 @@ public function test()
3131

3232
public function testAsEventSubscriber()
3333
{
34-
$kernel = new ConcreteMicroKernel('test', true);
34+
$kernel = new ConcreteMicroKernel('test', false);
3535
$kernel->boot();
3636

3737
$request = Request::create('/danger');

src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ protected function processValue($value, $isRoot = false)
7474
if ($optionalBehavior = '?' === $type[0]) {
7575
$type = substr($type, 1);
7676
$optionalBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
77-
} elseif ($optionalBehavior = '!' === $type[0]) {
78-
$type = substr($type, 1);
79-
$optionalBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE;
8077
}
8178
if (is_int($key)) {
8279
$key = $type;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ private function collectLineage($class, array &$lineage)
375375
if (isset($lineage[$class])) {
376376
return;
377377
}
378-
if (!$r = $this->container->getReflectionClass($class)) {
378+
if (!$r = $this->container->getReflectionClass($class, false)) {
379379
return;
380380
}
381381
if ($this->container instanceof $class) {

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase =
488488
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
489489
break;
490490
case 'expression':
491+
if (!class_exists(Expression::class)) {
492+
throw new \LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
493+
}
494+
491495
$arguments[$key] = new Expression($arg->nodeValue);
492496
break;
493497
case 'collection':

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,10 @@ private function resolveServices($value, $file, $isParameter = false)
727727
$value[$k] = $this->resolveServices($v, $file, $isParameter);
728728
}
729729
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
730+
if (!class_exists(Expression::class)) {
731+
throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
732+
}
733+
730734
return new Expression(substr($value, 2));
731735
} elseif (is_string($value) && 0 === strpos($value, '@')) {
732736
if (0 === strpos($value, '@@')) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
4+
5+
class ParentNotExists extends \NotExists
6+
{
7+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
88
use Symfony\Component\DependencyInjection\Reference;
99
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
10+
use Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists;
1011

1112
$container = new ContainerBuilder();
1213

1314
$container->register(HotPath\C1::class)->addTag('container.hot_path')->setPublic(true);
1415
$container->register(HotPath\C2::class)->addArgument(new Reference(HotPath\C3::class))->setPublic(true);
1516
$container->register(HotPath\C3::class);
17+
$container->register(ParentNotExists::class)->setPublic(true);
1618

1719
return $container;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function __construct()
3030

3131
$this->services = $this->privates = array();
3232
$this->methodMap = array(
33+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists' => 'getParentNotExistsService',
3334
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1' => 'getC1Service',
3435
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2' => 'getC2Service',
3536
);
@@ -67,6 +68,16 @@ public function getRemovedIds()
6768
);
6869
}
6970

71+
/**
72+
* Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists' shared service.
73+
*
74+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists
75+
*/
76+
protected function getParentNotExistsService()
77+
{
78+
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists();
79+
}
80+
7081
/**
7182
* Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1' shared service.
7283
*

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function boot()
112112

113113
return;
114114
}
115-
if ($this->debug && !isset($_SERVER['SHELL_VERBOSITY'])) {
115+
if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) {
116116
putenv('SHELL_VERBOSITY=3');
117117
$_ENV['SHELL_VERBOSITY'] = 3;
118118
$_SERVER['SHELL_VERBOSITY'] = 3;
@@ -451,8 +451,11 @@ protected function initializeContainer()
451451
$class = $this->getContainerClass();
452452
$cacheDir = $this->warmupDir ?: $this->getCacheDir();
453453
$cache = new ConfigCache($cacheDir.'/'.$class.'.php', $this->debug);
454-
$fresh = true;
455-
if (!$cache->isFresh()) {
454+
if ($fresh = $cache->isFresh()) {
455+
$this->container = require $cache->getPath();
456+
$fresh = \is_object($this->container);
457+
}
458+
if (!$fresh) {
456459
if ($this->debug) {
457460
$collectedLogs = array();
458461
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
@@ -502,11 +505,9 @@ protected function initializeContainer()
502505
$oldContainer = file_exists($cache->getPath()) && is_object($oldContainer = @include $cache->getPath()) ? new \ReflectionClass($oldContainer) : false;
503506

504507
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
505-
506-
$fresh = false;
508+
$this->container = require $cache->getPath();
507509
}
508510

509-
$this->container = require $cache->getPath();
510511
$this->container->set('kernel', $this);
511512

512513
if ($fresh) {

src/Symfony/Component/HttpKernel/Log/Logger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function __construct(string $minLevel = null, $output = 'php://stderr', c
4242
if (null === $minLevel) {
4343
$minLevel = LogLevel::WARNING;
4444

45-
if (isset($_SERVER['SHELL_VERBOSITY'])) {
46-
switch ((int) $_SERVER['SHELL_VERBOSITY']) {
45+
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
46+
switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) {
4747
case -1: $minLevel = LogLevel::ERROR; break;
4848
case 1: $minLevel = LogLevel::NOTICE; break;
4949
case 2: $minLevel = LogLevel::INFO; break;

src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,15 @@ public function process(ContainerBuilder $container)
6464
->replaceArgument(3, $loaders)
6565
;
6666

67-
if ($container->hasParameter('twig.default_path')) {
67+
if (!$container->hasParameter('twig.default_path')) {
68+
return;
69+
}
70+
71+
if ($container->hasDefinition($this->debugCommandServiceId)) {
6872
$container->getDefinition($this->debugCommandServiceId)->replaceArgument(4, $container->getParameter('twig.default_path'));
73+
}
74+
75+
if ($container->hasDefinition($this->updateCommandServiceId)) {
6976
$container->getDefinition($this->updateCommandServiceId)->replaceArgument(5, $container->getParameter('twig.default_path'));
7077
}
7178
}

0 commit comments

Comments
 (0)