From a7a1325eabe98d8e4421622801ee25583f83d957 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Wed, 23 May 2018 08:22:59 +0200 Subject: [PATCH 01/19] [Validator] Update sl translation --- .../Validator/Resources/translations/validators.sl.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf index 834db4015e..6f5fd98ca1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf @@ -314,6 +314,10 @@ This is not a valid Business Identifier Code (BIC). To ni veljavna identifikacijska koda podjetja (BIC). + + Error + Napaka + From 87b3ad91d240e1b2a4b5c30e038e177f5cb40c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Wed, 23 May 2018 22:28:22 +0200 Subject: [PATCH 02/19] [PhpUnitBridge] silence some stderr outputs --- src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php | 4 ++-- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php index 957499dfb6..83f4085c80 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php @@ -31,11 +31,11 @@ class CoverageListenerTest extends TestCase $dir = __DIR__.'/../Tests/Fixtures/coverage'; $phpunit = $_SERVER['argv'][0]; - exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text", $output); + exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output); $output = implode("\n", $output); $this->assertContains('FooCov', $output); - exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text", $output); + exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output); $output = implode("\n", $output); $this->assertNotContains('FooCov', $output); $this->assertContains("SutNotFoundTest::test\nCould not find the tested class.", $output); diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index a824eae8f2..59c7a1fe35 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -47,7 +47,7 @@ if ('phpdbg' === PHP_SAPI) { $PHP .= ' -qrr'; } -$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar`)) +$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`)) ? $PHP.' '.escapeshellarg($COMPOSER) : 'composer'; From 1314a952cd45525dd7b574d185fa5cafdeba9632 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 24 May 2018 09:11:23 +0200 Subject: [PATCH 03/19] [DI] remove dead code --- .../DependencyInjection/LazyProxy/ProxyHelper.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php index 84686efff5..57ea90eae0 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php @@ -62,17 +62,4 @@ class ProxyHelper return $prefix.$parent->name; } } - - private static function export($value) - { - if (!is_array($value)) { - return var_export($value, true); - } - $code = array(); - foreach ($value as $k => $v) { - $code[] = sprintf('%s => %s', var_export($k, true), self::export($v)); - } - - return sprintf('array(%s)', implode(', ', $code)); - } } From e88e0f30f168958ac311b7d865b26b30a572dac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 24 May 2018 13:48:55 +0200 Subject: [PATCH 04/19] [Serializer] Check the value of enable_max_depth if defined --- .../Component/Serializer/Normalizer/AbstractObjectNormalizer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 08fbc5fa3f..e02626a5fd 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -333,6 +333,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer { if ( !isset($context[static::ENABLE_MAX_DEPTH]) || + !$context[static::ENABLE_MAX_DEPTH] || !isset($attributesMetadata[$attribute]) || null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth() ) { From 47f0e732d92f9c52277909978f1c734e276193fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Thu, 24 May 2018 22:59:06 +0200 Subject: [PATCH 05/19] [HttpFoundation] Fix cookie test with xdebug Here's the failure without this patch: ``` Testing Symfony\Component\HttpFoundation\Tests\ResponseFunctionalTest F..... 6 / 6 (100%) Time: 1.07 seconds, Memory: 4.00MB There was 1 failure: 1) Symfony\Component\HttpFoundation\Tests\ResponseFunctionalTest::testCookie with data set #0 ('cookie_max_age') Failed asserting that string matches format description. --- Expected +++ Actual @@ @@ Warning: Expiry date cannot have a year greater than 9999 in /home/gadelat/PhpstormProjects/symfony/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.php on line 10 +Call Stack: + 0.0004 390392 1. {main}() /home/gadelat/PhpstormProjects/symfony/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.php:0 + 0.0178 500960 2. setcookie() /home/gadelat/PhpstormProjects/symfony/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.php:10 + + Array ( [0] => Content-Type: text/plain; charset=utf-8 [1] => Cache-Control: no-cache, private [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT - [3] => Set-Cookie: foo=bar; expires=Sat, 01-Jan-10000 02:46:40 GMT; Max-Age=%d; path=/ + [3] => Set-Cookie: foo=bar; expires=Sat, 01-Jan-10000 02:46:40 GMT; Max-Age=251875115405; path=/ ) shutdown /home/gadelat/PhpstormProjects/symfony/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php:49 ``` --- .../Tests/Fixtures/response-functional/common.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/common.inc b/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/common.inc index ba101d3578..f9c40a9a3c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/common.inc +++ b/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/common.inc @@ -22,6 +22,10 @@ error_reporting(-1); ini_set('html_errors', 0); ini_set('display_errors', 1); +if (ini_get('xdebug.default_enable')) { + xdebug_disable(); +} + header_remove('X-Powered-By'); header('Content-Type: text/plain; charset=utf-8'); From ef0b5004f80af699d8991498783f70cb80aa3e71 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 14:02:41 +0200 Subject: [PATCH 06/19] updated CHANGELOG for 2.8.41 --- CHANGELOG-2.8.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 9f76090b78..522a836647 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,15 @@ in 2.8 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.8.0...v2.8.1 +* 2.8.41 (2018-05-25) + + * bug #27359 [HttpFoundation] Fix perf issue during MimeTypeGuesser intialization (nicolas-grekas) + * security #cve-2018-11408 [SecurityBundle] Fail if security.http_utils cannot be configured + * security #cve-2018-11406 clear CSRF tokens when the user is logged out + * security #cve-2018-11385 Adding session authentication strategy to Guard to avoid session fixation + * security #cve-2018-11385 Adding session strategy to ALL listeners to avoid *any* possible fixation + * security #cve-2018-11386 [HttpFoundation] Break infinite loop in PdoSessionHandler when MySQL is in loose mode + * 2.8.40 (2018-05-21) * bug #26781 [Form] Fix precision of MoneyToLocalizedStringTransformer's divisions on transform() (syastrebov) From 786970f17d1a1c9c12bbf07ec0ac16c2cfd3360d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 14:02:50 +0200 Subject: [PATCH 07/19] updated VERSION for 2.8.41 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 70038526fa..d7ac3985b4 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.41-DEV'; + const VERSION = '2.8.41'; const VERSION_ID = 20841; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 41; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 37846d453a9ff12a2de1f46defb954a6bf14ac72 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 14:30:40 +0200 Subject: [PATCH 08/19] bumped Symfony version to 2.8.42 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index d7ac3985b4..0e298381b9 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.41'; - const VERSION_ID = 20841; + const VERSION = '2.8.42-DEV'; + const VERSION_ID = 20842; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 41; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 42; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 99327a6153fda78c36c9a61232cd061edcdb7f7e Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Fri, 25 May 2018 13:03:43 +0100 Subject: [PATCH 09/19] [Github] Update the pull-request template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 94f0fabcc4..b6f39741d9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | master for features / 2.7 up to 4.0 for bug fixes +| Branch? | master for features / 2.8 up to 4.1 for bug fixes | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | no From 37e543329acee80edba3ead5e2ea53e42f2c8b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Thu, 24 May 2018 23:24:34 +0200 Subject: [PATCH 10/19] Default testsuite to latest PHPUnit 6.* Necessary to fix each() function deprecation calls introduced in PHP 7.2 --- phpunit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit b/phpunit index c0ffe8ddef..f4b80ed064 100755 --- a/phpunit +++ b/phpunit @@ -8,7 +8,7 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) { exit(1); } if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) { - putenv('SYMFONY_PHPUNIT_VERSION=6.0'); + putenv('SYMFONY_PHPUNIT_VERSION=6.5'); } putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit'); require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit'; From 0a4a0c0bc95dbbbea443c048dd6c605a723eb5e3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 15:16:19 +0200 Subject: [PATCH 11/19] updated CHANGELOG for 3.4.11 --- CHANGELOG-3.4.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index 4b307918d3..37f4a76efc 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,19 @@ in 3.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.4.0...v3.4.1 +* 3.4.11 (2018-05-25) + + * bug #27364 [DI] Fix bad exception on uninitialized references to non-shared services (nicolas-grekas) + * bug #27359 [HttpFoundation] Fix perf issue during MimeTypeGuesser intialization (nicolas-grekas) + * security #cve-2018-11408 [SecurityBundle] Fail if security.http_utils cannot be configured + * security #cve-2018-11406 clear CSRF tokens when the user is logged out + * security #cve-2018-11385 migrating session for UsernamePasswordJsonAuthenticationListener + * security #cve-2018-11385 Adding session authentication strategy to Guard to avoid session fixation + * security #cve-2018-11385 Adding session strategy to ALL listeners to avoid *any* possible fixation + * security #cve-2018-11386 [HttpFoundation] Break infinite loop in PdoSessionHandler when MySQL is in loose mode + * bug #27341 [WebProfilerBundle] Fixed validator/dump trace CSS (yceruto) + * bug #27337 [FrameworkBundle] fix typo in CacheClearCommand (emilielorenzo) + * 3.4.10 (2018-05-21) * bug #27264 [Validator] Use strict type in URL validator (mimol91) From 136824a7491d2e41cc5fd1718184bdf61dddf80b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 15:16:28 +0200 Subject: [PATCH 12/19] updated VERSION for 3.4.11 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 5e3b9a8578..ca0f0b95c7 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.11-DEV'; + const VERSION = '3.4.11'; const VERSION_ID = 30411; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; const RELEASE_VERSION = 11; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From f918da98194f08fca2c07f86f6ec1c8b76b7448a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 15:32:08 +0200 Subject: [PATCH 13/19] bumped Symfony version to 3.4.12 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index ca0f0b95c7..242016f7c0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.11'; - const VERSION_ID = 30411; + const VERSION = '3.4.12-DEV'; + const VERSION_ID = 30412; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 11; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 12; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From 905f917e18e0e3066ed590920d07f430029ead08 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 15:32:46 +0200 Subject: [PATCH 14/19] updated CHANGELOG for 4.0.11 --- CHANGELOG-4.0.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index 906a472b9f..7131036ba4 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -7,6 +7,19 @@ in 4.0 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.0.0...v4.0.1 +* 4.0.11 (2018-05-25) + + * bug #27364 [DI] Fix bad exception on uninitialized references to non-shared services (nicolas-grekas) + * bug #27359 [HttpFoundation] Fix perf issue during MimeTypeGuesser intialization (nicolas-grekas) + * security #cve-2018-11408 [SecurityBundle] Fail if security.http_utils cannot be configured + * security #cve-2018-11406 clear CSRF tokens when the user is logged out + * security #cve-2018-11385 migrating session for UsernamePasswordJsonAuthenticationListener + * security #cve-2018-11385 Adding session authentication strategy to Guard to avoid session fixation + * security #cve-2018-11385 Adding session strategy to ALL listeners to avoid *any* possible fixation + * security #cve-2018-11386 [HttpFoundation] Break infinite loop in PdoSessionHandler when MySQL is in loose mode + * bug #27341 [WebProfilerBundle] Fixed validator/dump trace CSS (yceruto) + * bug #27337 [FrameworkBundle] fix typo in CacheClearCommand (emilielorenzo) + * 4.0.10 (2018-05-21) * bug #27264 [Validator] Use strict type in URL validator (mimol91) From a9817429316c4936a77efe8ea55cf1af653578f1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 15:32:52 +0200 Subject: [PATCH 15/19] updated VERSION for 4.0.11 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8004fc81ce..09a288d622 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -63,12 +63,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.0.11-DEV'; + const VERSION = '4.0.11'; const VERSION_ID = 40011; const MAJOR_VERSION = 4; const MINOR_VERSION = 0; const RELEASE_VERSION = 11; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2018'; const END_OF_LIFE = '01/2019'; From 3b4d7ab56c1e3816f226d10bca72fdabc7170150 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 24 May 2018 16:05:16 +0200 Subject: [PATCH 16/19] [DI] never inline lazy services --- .../Compiler/InlineServiceDefinitionsPass.php | 6 +- .../Tests/Dumper/PhpDumperTest.php | 16 +++- .../Tests/Fixtures/includes/classes.php | 6 +- .../Fixtures/php/services_non_shared_lazy.php | 74 +++++++++++++++++++ 4 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index e84a49eb70..d987f950d4 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -106,11 +106,15 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface */ private function isInlineableDefinition(ContainerBuilder $container, $id, Definition $definition) { + if ($definition->isDeprecated() || $definition->isLazy() || $definition->isSynthetic()) { + return false; + } + if (!$definition->isShared() || ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope(false)) { return true; } - if ($definition->isDeprecated() || $definition->isPublic() || $definition->isLazy()) { + if ($definition->isPublic()) { return false; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index d59106fc3a..e341a233b1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\DependencyInjection\Tests\Dumper; -use DummyProxyDumper; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; @@ -278,6 +277,19 @@ class PhpDumperTest extends TestCase $this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); } + public function testNonSharedLazyDefinitionReferences() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setShared(false)->setLazy(true); + $container->register('bar', 'stdClass')->addArgument(new Reference('foo', ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, false)); + $container->compile(); + + $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new \DummyProxyDumper()); + + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_non_shared_lazy.php', $dumper->dump()); + } + public function testInitializePropertiesBeforeMethodCalls() { require_once self::$fixturesPath.'/includes/classes.php'; @@ -343,7 +355,7 @@ class PhpDumperTest extends TestCase $dumper = new PhpDumper($container); - $dumper->setProxyDumper(new DummyProxyDumper()); + $dumper->setProxyDumper(new \DummyProxyDumper()); $dumper->dump(); $this->addToAssertionCount(1); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 92db8f3c5e..c805f7d721 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -84,16 +84,16 @@ class DummyProxyDumper implements ProxyDumper { public function isProxyCandidate(Definition $definition) { - return false; + return $definition->isLazy(); } public function getProxyFactoryCode(Definition $definition, $id) { - return ''; + return " // lazy factory\n\n"; } public function getProxyCode(Definition $definition) { - return ''; + return "// proxy code\n"; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php new file mode 100644 index 0000000000..f1f8e8409e --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php @@ -0,0 +1,74 @@ +services = + $this->scopedServices = + $this->scopeStacks = array(); + $this->scopes = array(); + $this->scopeChildren = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + 'foo' => 'getFooService', + ); + + $this->aliases = array(); + } + + /** + * {@inheritdoc} + */ + public function compile() + { + throw new LogicException('You cannot compile a dumped frozen container.'); + } + + /** + * {@inheritdoc} + */ + public function isFrozen() + { + return true; + } + + /** + * Gets the public 'bar' shared service. + * + * @return \stdClass + */ + protected function getBarService() + { + return $this->services['bar'] = new \stdClass($this->get('foo')); + } + + /** + * Gets the public 'foo' service. + * + * @return \stdClass + */ + public function getFooService($lazyLoad = true) + { + // lazy factory + + return new \stdClass(); + } +} + +// proxy code From 3de52144afd993438e7d82bea2a1f23cf71f73ca Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 May 2018 16:06:48 +0200 Subject: [PATCH 17/19] bumped Symfony version to 4.0.12 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 09a288d622..a2d61965b8 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -63,12 +63,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.0.11'; - const VERSION_ID = 40011; + const VERSION = '4.0.12-DEV'; + const VERSION_ID = 40012; const MAJOR_VERSION = 4; const MINOR_VERSION = 0; - const RELEASE_VERSION = 11; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 12; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2018'; const END_OF_LIFE = '01/2019'; From 40e59a6415b1b03c77432eb9654a6f6ec09fe2f7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 23 May 2018 15:49:17 +0200 Subject: [PATCH 18/19] Add code of Conduct links in our README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 16a7e1b489..b9fc51b3cf 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Community * [Join the Symfony Community][11] and meet other members at the [Symfony events][12]. * [Get Symfony support][13] on Stack Overflow, Slack, IRC, etc. * Follow us on [GitHub][14], [Twitter][15] and [Facebook][16]. +* Read our [Code of Conduct][24] and meet the [CARE Team][25] Contributing ------------ @@ -72,3 +73,5 @@ Symfony development is sponsored by [SensioLabs][21], led by the [21]: https://sensiolabs.com [22]: https://symfony.com/doc/current/contributing/code/core_team.html [23]: https://github.com/symfony/symfony-demo +[24]: https://symfony.com/coc +[25]: https://symfony.com/doc/current/contributing/code_of_conduct/care_team.html From b7feef00aec39baa2c2c7b2fe7ce054e3ccaa3d8 Mon Sep 17 00:00:00 2001 From: kiler129 Date: Tue, 22 May 2018 22:00:46 -0500 Subject: [PATCH 19/19] [HttpKernel] reset kernel start time on reboot --- src/Symfony/Component/HttpKernel/Kernel.php | 12 ++++-------- .../Component/HttpKernel/Tests/KernelTest.php | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 5e3b9a8578..9806e240f7 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -87,18 +87,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $this->debug = (bool) $debug; $this->rootDir = $this->getRootDir(); $this->name = $this->getName(); - - if ($this->debug) { - $this->startTime = microtime(true); - } } public function __clone() { - if ($this->debug) { - $this->startTime = microtime(true); - } - $this->booted = false; $this->container = null; $this->requestStackSize = 0; @@ -110,6 +102,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ public function boot() { + if ($this->debug) { + $this->startTime = microtime(true); + } + if (true === $this->booted) { if (!$this->requestStackSize && $this->resetServices) { if ($this->container->has('services_resetter')) { diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index a16ac37dee..628be627fd 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -901,6 +901,21 @@ EOF; $this->assertEquals(1, ResettableService::$counter); } + /** + * @group time-sensitive + */ + public function testKernelStartTimeIsResetWhileBootingAlreadyBootedKernel() + { + $kernel = $this->getKernelForTest(array('initializeBundles'), true); + $kernel->boot(); + $preReBoot = $kernel->getStartTime(); + + sleep(3600); //Intentionally large value to detect if ClockMock ever breaks + $kernel->boot(); + + $this->assertGreaterThan($preReBoot, $kernel->getStartTime()); + } + /** * Returns a mock for the BundleInterface. * @@ -970,10 +985,10 @@ EOF; return $kernel; } - protected function getKernelForTest(array $methods = array()) + protected function getKernelForTest(array $methods = array(), $debug = false) { $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') - ->setConstructorArgs(array('test', false)) + ->setConstructorArgs(array('test', $debug)) ->setMethods($methods) ->getMock(); $p = new \ReflectionProperty($kernel, 'rootDir');