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
diff --git a/README.md b/README.md
index 9db99a74c0..5796b1acd7 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,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
------------
@@ -71,3 +72,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
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';
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
index 008ba437d8..134eefe940 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
@@ -27,11 +27,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';
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
index 42ccb02ecd..9aee66c8e0 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
@@ -88,11 +88,15 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
*/
private function isInlineableDefinition($id, Definition $definition, ServiceReferenceGraph $graph)
{
+ if ($definition->getErrors() || $definition->isDeprecated() || $definition->isLazy() || $definition->isSynthetic()) {
+ return false;
+ }
+
if (!$definition->isShared()) {
return true;
}
- if ($definition->isDeprecated() || $definition->isPublic() || $definition->isLazy()) {
+ if ($definition->isPublic()) {
return false;
}
diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
index 6e3d75bb0b..d258980d66 100644
--- a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
+++ b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
@@ -54,17 +54,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));
- }
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index a4b0277b63..c4993b90a4 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 Psr\Container\ContainerInterface;
use Symfony\Component\Config\FileLocator;
@@ -488,6 +487,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))->setPublic(true);
+ $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';
@@ -556,7 +568,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 bc653a744c..bced911043 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
@@ -85,17 +85,17 @@ class DummyProxyDumper implements ProxyDumper
{
public function isProxyCandidate(Definition $definition)
{
- return false;
+ return $definition->isLazy();
}
public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null)
{
- 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..84a1dd80b3
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php
@@ -0,0 +1,90 @@
+services = $this->privates = array();
+ $this->methodMap = array(
+ 'bar' => 'getBarService',
+ );
+
+ $this->aliases = array();
+ }
+
+ public function reset()
+ {
+ $this->privates = array();
+ parent::reset();
+ }
+
+ public function compile()
+ {
+ throw new LogicException('You cannot compile a dumped container that was already compiled.');
+ }
+
+ public function isCompiled()
+ {
+ return true;
+ }
+
+ public function getRemovedIds()
+ {
+ return array(
+ 'Psr\\Container\\ContainerInterface' => true,
+ 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
+ 'foo' => true,
+ );
+ }
+
+ protected function createProxy($class, \Closure $factory)
+ {
+ return $factory();
+ }
+
+ /**
+ * Gets the public 'bar' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getBarService()
+ {
+ return $this->services['bar'] = new \stdClass($this->getFooService());
+ }
+
+ /**
+ * Gets the private 'foo' service.
+ *
+ * @return \stdClass
+ */
+ protected function getFooService($lazyLoad = true)
+ {
+ // lazy factory
+
+ return new \stdClass();
+ }
+}
+
+// proxy code
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');
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index a2d61965b8..893cb6a616 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -79,18 +79,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$this->debug = $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;
@@ -102,6 +94,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 9dab664cf5..fde94a84cc 100644
--- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php
@@ -589,6 +589,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.
*
@@ -658,10 +673,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');
diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
index e2b15d1aa1..691fa7a3a7 100644
--- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
@@ -319,6 +319,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()
) {
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 @@
To ni veljavna identifikacijska koda podjetja (BIC).
+
+
+ Napaka
+