Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1da8591

Browse filesBrowse files
Merge branch '3.4' into 4.0
* 3.4: SCA with Php Inspections (EA Extended) Add test case for #25264 Fixed the null value exception case. Remove rc/beta suffix from composer.json files Throw an exception is expression language is not installed Fail as early and noisily as possible [Console][DI] Fail gracefully [FrameworkBundle] Fix visibility of a test helper [link] clear the cache after linking [DI] Trigger deprecation when setting a to-be-private synthetic service [link] Prevent warnings when running link with 2.7 [Validator] ExpressionValidator should use OBJECT_TO_STRING to allow value in message do not eagerly filter comment lines [WebProfilerBundle], [TwigBundle] Fix Profiler breaking XHTML pages (Content-Type: application/xhtml+xml)
2 parents 86fb66f + 0b0542d commit 1da8591
Copy full SHA for 1da8591

File tree

Expand file treeCollapse file tree

30 files changed

+203
-65
lines changed
Filter options
Expand file treeCollapse file tree

30 files changed

+203
-65
lines changed

‎link

Copy file name to clipboardExpand all lines: link
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ if (!is_dir("$argv[1]/vendor/symfony")) {
3535
}
3636

3737
$sfPackages = array('symfony/symfony' => __DIR__);
38+
39+
$filesystem = new Filesystem();
3840
foreach (glob(__DIR__.'/src/Symfony/{Bundle,Bridge,Component,Component/Security}/*', GLOB_BRACE | GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
39-
$sfPackages[json_decode(file_get_contents("$dir/composer.json"))->name] = $dir;
41+
if ($filesystem->exists($composer = "$dir/composer.json")) {
42+
$sfPackages[json_decode(file_get_contents($composer))->name] = $dir;
43+
}
4044
}
4145

42-
$filesystem = new Filesystem();
4346
foreach (glob("$argv[1]/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
4447
$package = 'symfony/'.basename($dir);
4548
if (is_link($dir)) {
@@ -57,3 +60,7 @@ foreach (glob("$argv[1]/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir)
5760
$filesystem->symlink($sfDir, $dir);
5861
echo "\"$package\" has been linked to \"$sfPackages[$package]\".".PHP_EOL;
5962
}
63+
64+
foreach (glob("$argv[1]/var/cache/*") as $cacheDir) {
65+
$filesystem->remove($cacheDir);
66+
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
5959
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION"));
6060
}
6161
if (extension_loaded('openssl') && ini_get('allow_url_fopen') && !isset($_SERVER['http_proxy']) && !isset($_SERVER['https_proxy'])) {
62-
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
62+
$remoteZip = "https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip";
63+
$remoteZipStream = @fopen($remoteZip, 'rb');
64+
if (!$remoteZipStream) {
65+
throw new \RuntimeException("Could not find $remoteZip");
66+
}
67+
stream_copy_to_stream($remoteZipStream, fopen("$PHPUNIT_VERSION.zip", 'wb'));
6368
} else {
6469
@unlink("$PHPUNIT_VERSION.zip");
6570
passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip");

‎src/Symfony/Bridge/Twig/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/asset": "~3.4|~4.0",
2525
"symfony/dependency-injection": "~3.4|~4.0",
2626
"symfony/finder": "~3.4|~4.0",
27-
"symfony/form": "~3.4-beta4|~4.0-beta4",
27+
"symfony/form": "~3.4|~4.0",
2828
"symfony/http-foundation": "~3.4|~4.0",
2929
"symfony/http-kernel": "~3.4|~4.0",
3030
"symfony/polyfill-intl-icu": "~1.0",

‎src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private function createRedirectController($httpPort = null, $httpsPort = null)
252252
return new RedirectController(null, $httpPort, $httpsPort);
253253
}
254254

255-
public function assertRedirectUrl(Response $returnResponse, $expectedUrl)
255+
private function assertRedirectUrl(Response $returnResponse, $expectedUrl)
256256
{
257257
$this->assertTrue($returnResponse->isRedirect($expectedUrl), "Expected: $expectedUrl\nGot: ".$returnResponse->headers->get('Location'));
258258
}

‎src/Symfony/Bundle/FrameworkBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/cache": "~3.4|~4.0",
2222
"symfony/dependency-injection": "~3.4|~4.0",
2323
"symfony/config": "~3.4|~4.0",
24-
"symfony/event-dispatcher": "~3.4-beta4|~4.0-beta4",
24+
"symfony/event-dispatcher": "~3.4|~4.0",
2525
"symfony/http-foundation": "~3.4|~4.0",
2626
"symfony/http-kernel": "~3.4|~4.0",
2727
"symfony/polyfill-mbstring": "~1.0",

‎src/Symfony/Bundle/SecurityBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": "^7.1.3",
2020
"ext-xml": "*",
21-
"symfony/security": "~3.4-beta5|~4.0-beta5",
21+
"symfony/security": "~3.4|~4.0",
2222
"symfony/dependency-injection": "~3.4|~4.0",
2323
"symfony/http-kernel": "~3.4|~4.0"
2424
},
@@ -30,7 +30,7 @@
3030
"symfony/dom-crawler": "~3.4|~4.0",
3131
"symfony/event-dispatcher": "~3.4|~4.0",
3232
"symfony/form": "~3.4|~4.0",
33-
"symfony/framework-bundle": "~3.4-rc1|~4.0-rc1",
33+
"symfony/framework-bundle": "~3.4|~4.0",
3434
"symfony/http-foundation": "~3.4|~4.0",
3535
"symfony/translation": "~3.4|~4.0",
3636
"symfony/twig-bundle": "~3.4|~4.0",

‎src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{# This file is based on WebProfilerBundle/Resources/views/Profiler/base_js.html.twig.
22
If you make any change in this file, verify the same change is needed in the other file. #}
3-
<script{% if csp_script_nonce is defined and csp_script_nonce %} nonce={{ csp_script_nonce }}{% endif %}>/*<![CDATA[*/
3+
<script{% if csp_script_nonce is defined and csp_script_nonce %} nonce="{{ csp_script_nonce }}"{% endif %}>/*<![CDATA[*/
44
{# Caution: the contents of this file are processed by Twig before loading
55
them as JavaScript source code. Always use '/*' comments instead
66
of '//' comments to avoid impossible-to-debug side-effects #}

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{# This file is partially duplicated in TwigBundle/Resources/views/base_js.html.twig. If you
22
make any change in this file, verify the same change is needed in the other file. #}
3-
<script{% if csp_script_nonce is defined and csp_script_nonce %} nonce={{ csp_script_nonce }}{% endif %}>/*<![CDATA[*/
3+
<script{% if csp_script_nonce is defined and csp_script_nonce %} nonce="{{ csp_script_nonce }}"{% endif %}>/*<![CDATA[*/
44
{# Caution: the contents of this file are processed by Twig before loading
55
them as JavaScript source code. Always use '/*' comments instead
66
of '//' comments to avoid impossible-to-debug side-effects #}

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
44
{{ include('@WebProfiler/Profiler/toolbar.css.twig') }}
55
</style>
6-
<script{% if csp_script_nonce %} nonce={{ csp_script_nonce }}{% endif %}>/*<![CDATA[*/
6+
<script{% if csp_script_nonce %} nonce="{{ csp_script_nonce }}"{% endif %}>/*<![CDATA[*/
77
(function () {
88
Sfjs.load(
99
'sfwdt{{ token }}',

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+28-5Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
4040
use Symfony\Component\Console\Exception\CommandNotFoundException;
4141
use Symfony\Component\Console\Exception\LogicException;
42+
use Symfony\Component\Debug\ErrorHandler;
43+
use Symfony\Component\Debug\Exception\FatalThrowableError;
4244
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
4345

4446
/**
@@ -116,6 +118,25 @@ public function run(InputInterface $input = null, OutputInterface $output = null
116118
$output = new ConsoleOutput();
117119
}
118120

121+
$renderException = function ($e) use ($output) {
122+
if (!$e instanceof \Exception) {
123+
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
124+
}
125+
if ($output instanceof ConsoleOutputInterface) {
126+
$this->renderException($e, $output->getErrorOutput());
127+
} else {
128+
$this->renderException($e, $output);
129+
}
130+
};
131+
if ($phpHandler = set_exception_handler($renderException)) {
132+
restore_exception_handler();
133+
if (!is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
134+
$debugHandler = true;
135+
} elseif ($debugHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
136+
$phpHandler[0]->setExceptionHandler($debugHandler);
137+
}
138+
}
139+
119140
$this->configureIO($input, $output);
120141

121142
try {
@@ -125,11 +146,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null
125146
throw $e;
126147
}
127148

128-
if ($output instanceof ConsoleOutputInterface) {
129-
$this->renderException($e, $output->getErrorOutput());
130-
} else {
131-
$this->renderException($e, $output);
132-
}
149+
$renderException($e);
133150

134151
$exitCode = $e->getCode();
135152
if (is_numeric($exitCode)) {
@@ -140,6 +157,12 @@ public function run(InputInterface $input = null, OutputInterface $output = null
140157
} else {
141158
$exitCode = 1;
142159
}
160+
} finally {
161+
if (!$phpHandler) {
162+
restore_exception_handler();
163+
} elseif (!$debugHandler) {
164+
$phpHandler[0]->setExceptionHandler(null);
165+
}
143166
}
144167

145168
if ($this->autoExit) {

‎src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
1515
use Symfony\Component\DependencyInjection\ContainerInterface;
1616
use Symfony\Component\DependencyInjection\Definition;
17+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1718
use Symfony\Component\DependencyInjection\ExpressionLanguage;
1819
use Symfony\Component\DependencyInjection\Reference;
1920
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -148,6 +149,10 @@ private function getDefinitionId(string $id): ?string
148149
private function getExpressionLanguage()
149150
{
150151
if (null === $this->expressionLanguage) {
152+
if (!class_exists(ExpressionLanguage::class)) {
153+
throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
154+
}
155+
151156
$providers = $this->container->getExpressionLanguageProviders();
152157
$this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) {
153158
if ('""' === substr_replace($arg, '', 1, -1)) {

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+11-7Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,16 @@ public function dump(array $options = array())
224224
{$namespaceLine}
225225
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
226226
227-
if (!class_exists(\\Container{$hash}\\{$options['class']}::class, false)) {
228-
require __DIR__.'/Container{$hash}/{$options['class']}.php';
227+
if (\\class_exists(\\Container{$hash}\\{$options['class']}::class, false)) {
228+
// no-op
229+
} elseif (!include __DIR__.'/Container{$hash}/{$options['class']}.php') {
230+
touch(__DIR__.'/Container{$hash}.legacy');
231+
232+
return;
229233
}
230234
231-
if (!class_exists({$options['class']}::class, false)) {
232-
class_alias(\\Container{$hash}\\{$options['class']}::class, {$options['class']}::class, false);
235+
if (!\\class_exists({$options['class']}::class, false)) {
236+
\\class_alias(\\Container{$hash}\\{$options['class']}::class, {$options['class']}::class, false);
233237
}
234238
235239
return new \\Container{$hash}\\{$options['class']}();
@@ -424,13 +428,13 @@ private function addServiceInclude(string $cId, Definition $definition, \SplObje
424428
}
425429

426430
foreach (array_diff_key(array_flip($lineage), $this->inlinedRequires) as $file => $class) {
427-
$code .= sprintf(" require_once %s;\n", $file);
431+
$code .= sprintf(" include_once %s;\n", $file);
428432
}
429433
}
430434

431435
foreach ($inlinedDefinitions as $def) {
432436
if ($file = $def->getFile()) {
433-
$code .= sprintf(" require_once %s;\n", $this->dumpValue($file));
437+
$code .= sprintf(" include_once %s;\n", $this->dumpValue($file));
434438
}
435439
}
436440

@@ -1082,7 +1086,7 @@ private function addInlineRequires() :string
10821086
foreach ($lineage as $file) {
10831087
if (!isset($this->inlinedRequires[$file])) {
10841088
$this->inlinedRequires[$file] = true;
1085-
$code .= sprintf(" require_once %s;\n", $file);
1089+
$code .= sprintf(" include_once %s;\n", $file);
10861090
}
10871091
}
10881092

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
231231
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
232232
// Returns the public 'method_call1' shared service.
233233

234-
require_once ($this->targetDirs[0].'/Fixtures/includes/foo.php');
234+
include_once ($this->targetDirs[0].'/Fixtures/includes/foo.php');
235235

236236
$this->services['method_call1'] = $instance = new \Bar\FooClass();
237237

@@ -483,12 +483,16 @@ class ProjectServiceContainer extends Container
483483

484484
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
485485

486-
if (!class_exists(\Container%s\ProjectServiceContainer::class, false)) {
487-
require __DIR__.'/Container%s/ProjectServiceContainer.php';
486+
if (\class_exists(\Container%s\ProjectServiceContainer::class, false)) {
487+
// no-op
488+
} elseif (!include __DIR__.'/Container%s/ProjectServiceContainer.php') {
489+
touch(__DIR__.'/Container%s.legacy');
490+
491+
return;
488492
}
489493

490-
if (!class_exists(ProjectServiceContainer::class, false)) {
491-
class_alias(\Container%s\ProjectServiceContainer::class, ProjectServiceContainer::class, false);
494+
if (!\class_exists(ProjectServiceContainer::class, false)) {
495+
\class_alias(\Container%s\ProjectServiceContainer::class, ProjectServiceContainer::class, false);
492496
}
493497

494498
return new \Container%s\ProjectServiceContainer();

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ protected function getLazyContextIgnoreInvalidRefService()
340340
*/
341341
protected function getMethodCall1Service()
342342
{
343-
require_once '%path%foo.php';
343+
include_once '%path%foo.php';
344344

345345
$this->services['method_call1'] = $instance = new \Bar\FooClass();
346346

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public function __construct()
3737

3838
$this->aliases = array();
3939

40-
require_once $this->targetDirs[1].'/includes/HotPath/I1.php';
41-
require_once $this->targetDirs[1].'/includes/HotPath/P1.php';
42-
require_once $this->targetDirs[1].'/includes/HotPath/T1.php';
43-
require_once $this->targetDirs[1].'/includes/HotPath/C1.php';
40+
include_once $this->targetDirs[1].'/includes/HotPath/I1.php';
41+
include_once $this->targetDirs[1].'/includes/HotPath/P1.php';
42+
include_once $this->targetDirs[1].'/includes/HotPath/T1.php';
43+
include_once $this->targetDirs[1].'/includes/HotPath/C1.php';
4444
}
4545

4646
public function reset()
@@ -95,8 +95,8 @@ protected function getC1Service()
9595
*/
9696
protected function getC2Service()
9797
{
98-
require_once $this->targetDirs[1].'/includes/HotPath/C3.php';
99-
require_once $this->targetDirs[1].'/includes/HotPath/C2.php';
98+
include_once $this->targetDirs[1].'/includes/HotPath/C3.php';
99+
include_once $this->targetDirs[1].'/includes/HotPath/C2.php';
100100

101101
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3());
102102
}

‎src/Symfony/Component/Form/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"symfony/http-kernel": "~3.4|~4.0",
3434
"symfony/security-csrf": "~3.4|~4.0",
3535
"symfony/translation": "~3.4|~4.0",
36-
"symfony/var-dumper": "~3.4-beta3|~4.0-beta3"
36+
"symfony/var-dumper": "~3.4|~4.0"
3737
},
3838
"conflict": {
3939
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",

‎src/Symfony/Component/HttpKernel/Kernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Kernel.php
+18-8Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public function getContainer()
356356
*/
357357
public function setAnnotatedClassCache(array $annotatedClasses)
358358
{
359-
file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)));
359+
file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)), LOCK_EX);
360360
}
361361

362362
/**
@@ -452,15 +452,21 @@ protected function initializeContainer()
452452
$cacheDir = $this->warmupDir ?: $this->getCacheDir();
453453
$cache = new ConfigCache($cacheDir.'/'.$class.'.php', $this->debug);
454454
if ($fresh = $cache->isFresh()) {
455-
$this->container = require $cache->getPath();
455+
// Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
456+
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
457+
try {
458+
$this->container = include $cache->getPath();
459+
} finally {
460+
error_reporting($errorLevel);
461+
}
456462
$fresh = \is_object($this->container);
457463
}
458464
if (!$fresh) {
459465
if ($this->debug) {
460466
$collectedLogs = array();
461467
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
462468
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
463-
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
469+
return $previousHandler ? $previousHandler($type & ~E_WARNING, $message, $file, $line) : E_WARNING === $type;
464470
}
465471

466472
if (isset($collectedLogs[$message])) {
@@ -487,23 +493,27 @@ protected function initializeContainer()
487493
'count' => 1,
488494
);
489495
});
496+
} else {
497+
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
490498
}
491499

492500
try {
493501
$container = null;
494502
$container = $this->buildContainer();
495503
$container->compile();
504+
505+
$oldContainer = file_exists($cache->getPath()) && is_object($oldContainer = include $cache->getPath()) ? new \ReflectionClass($oldContainer) : false;
496506
} finally {
497507
if ($this->debug) {
498508
restore_error_handler();
499509

500510
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
501511
file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : '');
512+
} else {
513+
error_reporting($errorLevel);
502514
}
503515
}
504516

505-
$oldContainer = file_exists($cache->getPath()) && is_object($oldContainer = @include $cache->getPath()) ? new \ReflectionClass($oldContainer) : false;
506-
507517
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
508518
$this->container = require $cache->getPath();
509519
}
@@ -519,13 +529,13 @@ protected function initializeContainer()
519529
// old container files are not removed immediately,
520530
// but on a next dump of the container.
521531
$oldContainerDir = dirname($oldContainer->getFileName());
522-
foreach (glob(dirname($oldContainerDir).'/*.legacyContainer') as $legacyContainer) {
523-
if ($oldContainerDir.'.legacyContainer' !== $legacyContainer && @unlink($legacyContainer)) {
532+
foreach (glob(dirname($oldContainerDir).'/*.legacy') as $legacyContainer) {
533+
if ($oldContainerDir.'.legacy' !== $legacyContainer && @unlink($legacyContainer)) {
524534
(new Filesystem())->remove(substr($legacyContainer, 0, -16));
525535
}
526536
}
527537

528-
touch($oldContainerDir.'.legacyContainer');
538+
touch($oldContainerDir.'.legacy');
529539
}
530540

531541
if ($this->container->has('cache_warmer')) {

‎src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public function testKernelReset()
521521

522522
$this->assertTrue(get_class($kernel->getContainer()) !== $containerClass);
523523
$this->assertFileExists($containerFile);
524-
$this->assertFileExists(dirname($containerFile).'.legacyContainer');
524+
$this->assertFileExists(dirname($containerFile).'.legacy');
525525
}
526526

527527
public function testKernelPass()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.