From 98021ae918c00ac49adeb20f1d54604b16cd6a77 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 17 May 2017 20:35:24 +0200 Subject: [PATCH 01/75] bumped Symfony version to 3.3.0 --- 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 4a3bb7facbe9e..8d4953886e3a0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.0-RC1'; + const VERSION = '3.3.0-DEV'; const VERSION_ID = 30300; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; const RELEASE_VERSION = 0; - const EXTRA_VERSION = 'RC1'; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018'; From 3d6d80d843842851f4758faacb86039573c42a5d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 18 May 2017 11:06:54 +0200 Subject: [PATCH 02/75] Improved how profiler errors are dispalyed on small screens --- .../Resources/views/Profiler/profiler.css.twig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig index 6bff3723d9d2d..56c02685f63dd 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig @@ -973,6 +973,18 @@ table.logs .sf-call-stack abbr { display: block; } + #sidebar:not(:hover):not(.expanded) .label .count { + border-radius: 50%; + border: 1px solid #eee; + height: 8px; + min-width: 0; + padding: 0; + right: 4px; + text-indent: -9999px; + top: 50%; + width: 8px; + } + .visible-small { display: inherit; } From 3230fc7e700f19649a17fbb3258d66c84f066565 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 17 May 2017 11:20:42 +0200 Subject: [PATCH 03/75] Fix kernel.project_dir extensibility --- src/Symfony/Component/HttpKernel/Kernel.php | 3 +- .../Component/HttpKernel/Tests/KernelTest.php | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8d4953886e3a0..b5df6c6cdb24d 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -82,7 +82,6 @@ public function __construct($environment, $debug) $this->environment = $environment; $this->debug = (bool) $debug; $this->rootDir = $this->getRootDir(); - $this->projectDir = $this->getProjectDir(); $this->name = $this->getName(); if ($this->debug) { @@ -604,7 +603,7 @@ protected function getKernelParameters() return array_merge( array( 'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir, - 'kernel.project_dir' => realpath($this->projectDir) ?: $this->projectDir, + 'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(), 'kernel.environment' => $this->environment, 'kernel.debug' => $this->debug, 'kernel.name' => $this->name, diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 4cc31d49903b1..d2a27d03aaf37 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Config\EnvParametersResource; @@ -761,6 +762,15 @@ public function testSymfonyEnvironmentVariables() unset($_SERVER['SYMFONY__FOO__BAR']); } + public function testProjectDirExtension() + { + $kernel = new CustomProjectDirKernel('test', true); + $kernel->boot(); + + $this->assertSame('foo', $kernel->getProjectDir()); + $this->assertSame('foo', $kernel->getContainer()->getParameter('kernel.project_dir')); + } + /** * Returns a mock for the BundleInterface. * @@ -857,3 +867,34 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = { } } + +class CustomProjectDirKernel extends Kernel +{ + private $baseDir; + + public function __construct() + { + parent::__construct('test', false); + + $this->baseDir = 'foo'; + } + + public function registerBundles() + { + return array(); + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + } + + public function getProjectDir() + { + return $this->baseDir; + } + + public function getRootDir() + { + return __DIR__.'/Fixtures'; + } +} From a34b8ce2df05808991c0b0b331c7a409aca91329 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 18 May 2017 14:41:01 +0200 Subject: [PATCH 04/75] CI fixes --- .github/PULL_REQUEST_TEMPLATE.md | 5 +++-- .travis.yml | 10 +++++++++- appveyor.yml | 4 ++-- .../Storage/Handler/MongoDbSessionHandlerTest.php | 12 ++++++++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d35bbdeb69e23..cb9b8a69c1638 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | master / 2.7, 2.8 or 3.2 +| Branch? | 3.4 or master / 2.7, 2.8, 3.2 or 3.3 | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no @@ -13,7 +13,8 @@ diff --git a/.travis.yml b/.travis.yml index e33ea4d8764db..42cdc02bae497 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,8 +76,12 @@ before_install: echo hhvm.jit = 0 >> $INI echo apc.enable_cli = 1 >> $INI echo extension = ldap.so >> $INI - [[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI [[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI + if [[ $PHP = 5.* ]]; then + echo extension = mongo.so >> $INI + elif [[ $PHP = 7.* ]]; then + echo extension = mongodb.so >> $INI + fi # Matrix lines for intermediate PHP versions are skipped for pull requests if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then @@ -136,6 +140,10 @@ install: export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi + if [[ ! $skip && $PHP = 7.* ]]; then + ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb) + fi + - if [[ ! $skip ]]; then $COMPOSER_UP; fi - if [[ ! $skip ]]; then ./phpunit install; fi - | diff --git a/appveyor.yml b/appveyor.yml index 0ec2c5a3a00e1..6c7e5e1d846a4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,7 @@ install: - 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul - appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/ICU-51.2-dlls.zip - 7z x ICU-51.2-dlls.zip -y >nul - - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.1.3-Win32-VC14-x64.zip + - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.1.3-Win32-VC14-x86.zip - cd ext - appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/php_intl-3.0.0-5.3-nts-vc9-x86.zip - 7z x php_intl-3.0.0-5.3-nts-vc9-x86.zip -y >nul @@ -58,7 +58,7 @@ install: test_script: - cd c:\projects\symfony - - cd c:\php && 7z x php-7.1.3-Win32-VC14-x64.zip -y >nul && copy /Y php.ini-min php.ini + - cd c:\php && 7z x php-7.1.3-Win32-VC14-x86.zip -y >nul && copy /Y php.ini-min php.ini - cd c:\projects\symfony - php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel! - cd c:\php && 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul && copy /Y php.ini-min php.ini diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index f23161c10b076..128b9b52f505f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -31,7 +31,11 @@ protected function setUp() { parent::setUp(); - if (!extension_loaded('mongo') && !extension_loaded('mongodb')) { + if (extension_loaded('mongodb')) { + if (!class_exists('MongoDB\Client')) { + $this->markTestSkipped('The mongodb/mongodb package is required.'); + } + } elseif (!extension_loaded('mongo')) { $this->markTestSkipped('The Mongo or MongoDB extension is required.'); } @@ -109,7 +113,7 @@ public function testRead() if (phpversion('mongodb')) { $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$that->options['expiry_field']]['$gte']); - $that->assertGreaterThanOrEqual(round(((int) $criteria[$that->options['expiry_field']]['$gte']) / 1000), $testTimeout); + $that->assertGreaterThanOrEqual(round((string) $criteria[$that->options['expiry_field']]['$gte'] / 1000), $testTimeout); } else { $that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$gte']); $that->assertGreaterThanOrEqual($criteria[$that->options['expiry_field']]['$gte']->sec, $testTimeout); @@ -168,7 +172,7 @@ public function testWrite() $that->assertEquals('bar', $data[$that->options['data_field']]->getData()); $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['time_field']]); $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['expiry_field']]); - $that->assertGreaterThanOrEqual($expectedExpiry, round(((int) $data[$that->options['expiry_field']]) / 1000)); + $that->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$that->options['expiry_field']] / 1000)); } else { $that->assertEquals('bar', $data[$that->options['data_field']]->bin); $that->assertInstanceOf('MongoDate', $data[$that->options['time_field']]); @@ -294,7 +298,7 @@ public function testGc() ->will($this->returnCallback(function ($criteria) use ($that) { if (phpversion('mongodb')) { $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$that->options['expiry_field']]['$lt']); - $that->assertGreaterThanOrEqual(time() - 1, round(((int) $criteria[$that->options['expiry_field']]['$lt']) / 1000)); + $that->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$that->options['expiry_field']]['$lt'] / 1000)); } else { $that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$lt']); $that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec); From 3fcc810dd70f1bf2bce6997fa235b0cda43bfd41 Mon Sep 17 00:00:00 2001 From: Chad Sikorra Date: Thu, 18 May 2017 21:05:32 -0500 Subject: [PATCH 05/75] Use 0.0.0.0 as the server log host default. --- src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php index 50d53202277b2..eed32c5a2055f 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php @@ -47,7 +47,7 @@ protected function configure() } $this - ->addOption('host', null, InputOption::VALUE_REQUIRED, 'The server host', '0:9911') + ->addOption('host', null, InputOption::VALUE_REQUIRED, 'The server host', '0.0.0.0:9911') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The line format', ConsoleFormatter::SIMPLE_FORMAT) ->addOption('date-format', null, InputOption::VALUE_REQUIRED, 'The date format', ConsoleFormatter::SIMPLE_DATE) ->addOption('filter', null, InputOption::VALUE_REQUIRED, 'An expression to filter log. Example: "level > 200 or channel in [\'app\', \'doctrine\']"') From fab0629206ec572bfe35d9549d6a195151636853 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 18 May 2017 20:32:14 +0200 Subject: [PATCH 06/75] [Intl] Fix intl tests for PHP < 5.5.10 --- .../DateFormatter/AbstractIntlDateFormatterTest.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index ee8b5c9447edc..43001a74fc6cb 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -342,7 +342,7 @@ public function formatWithTimezoneProvider() /** * @dataProvider formatTimezoneProvider - * @requires PHP 5.5 + * @requires PHP 5.5.10 */ public function testFormatTimezone($pattern, $timezone, $expected) { @@ -459,15 +459,11 @@ public function testFormatWithConstructorTimezone() ); } + /** + * @requires PHP 5.5.10 + */ public function testFormatWithDateTimeZoneGmt() { - if (PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) { - $this->markTestSkipped('Only in PHP 5.5+ IntlDateFormatter allows to use DateTimeZone objects.'); - } - if (PHP_VERSION_ID < 50510) { - $this->markTestSkipped('Before PHP 5.5.10 the GMT timezone used to be converted to UTC.'); - } - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('GMT'), IntlDateFormatter::GREGORIAN, 'zzz'); $this->assertEquals('GMT', $formatter->format(0)); From d740342a28b80f0ad58d90364134a92966822f46 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 19 May 2017 14:11:07 +0200 Subject: [PATCH 07/75] typo --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6c7e5e1d846a4..ae43082f82fd8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,7 +57,7 @@ install: - php phpunit install test_script: - - cd c:\projects\symfony + - SET X=0 - cd c:\php && 7z x php-7.1.3-Win32-VC14-x86.zip -y >nul && copy /Y php.ini-min php.ini - cd c:\projects\symfony - php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel! From 3c3a276374d50c9dd30a7509f3d882611318354a Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 19 May 2017 17:54:24 +0200 Subject: [PATCH 08/75] [DI][Serializer] Fix missing de(normalizer|coder) autoconfig --- .../DependencyInjection/FrameworkExtension.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c65c1f8e740be..e72a02d24480e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -47,11 +47,13 @@ use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; use Symfony\Component\Serializer\Encoder\CsvEncoder; +use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\YamlEncoder; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; use Symfony\Component\Serializer\Normalizer\DataUriNormalizer; use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; +use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Validator\ConstraintValidatorInterface; @@ -276,8 +278,12 @@ public function load(array $configs, ContainerBuilder $container) ->addTag('property_info.access_extractor'); $container->registerForAutoconfiguration(EncoderInterface::class) ->addTag('serializer.encoder'); + $container->registerForAutoconfiguration(DecoderInterface::class) + ->addTag('serializer.encoder'); $container->registerForAutoconfiguration(NormalizerInterface::class) ->addTag('serializer.normalizer'); + $container->registerForAutoconfiguration(DenormalizerInterface::class) + ->addTag('serializer.normalizer'); $container->registerForAutoconfiguration(ConstraintValidatorInterface::class) ->addTag('validator.constraint_validator'); $container->registerForAutoconfiguration(ObjectInitializerInterface::class) From c2db0c14e138470a8d3937c3ef682a5b7a0348a3 Mon Sep 17 00:00:00 2001 From: meyerbaptiste Date: Fri, 19 May 2017 23:03:53 +0200 Subject: [PATCH 09/75] [DependencyInjection] Fix dumping of RewindableGenerator with empty IteratorArgument --- .../DependencyInjection/Dumper/PhpDumper.php | 29 +++++++++++-------- .../Tests/ContainerBuilderTest.php | 14 ++++++++- .../Tests/Dumper/PhpDumperTest.php | 10 ++++++- .../Tests/Fixtures/containers/container9.php | 4 +-- .../Tests/Fixtures/includes/classes.php | 4 ++- .../Tests/Fixtures/php/services9.php | 8 +++-- .../Tests/Fixtures/php/services9_compiled.php | 8 +++-- .../Tests/Fixtures/xml/services9.xml | 2 ++ .../Tests/Fixtures/yaml/services9.yml | 4 +-- .../Tests/Loader/XmlFileLoaderTest.php | 3 +- .../Tests/Loader/YamlFileLoaderTest.php | 2 +- 11 files changed, 62 insertions(+), 26 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 66a6c56bf5cc9..baec10f7e90a0 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1429,24 +1429,29 @@ private function dumpValue($value, $interpolate = true) } if ($value instanceof IteratorArgument) { - $countCode = array(); - $countCode[] = 'function () {'; $operands = array(0); - $code = array(); $code[] = 'new RewindableGenerator(function () {'; - foreach ($value->getValues() as $k => $v) { - ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ($c)" : ++$operands[0]; - $v = $this->wrapServiceConditionals($v, sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); - foreach (explode("\n", $v) as $v) { - if ($v) { - $code[] = ' '.$v; + + if (!$values = $value->getValues()) { + $code[] = ' return new \EmptyIterator();'; + } else { + $countCode = array(); + $countCode[] = 'function () {'; + + foreach ($values as $k => $v) { + ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ($c)" : ++$operands[0]; + $v = $this->wrapServiceConditionals($v, sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); + foreach (explode("\n", $v) as $v) { + if ($v) { + $code[] = ' '.$v; + } } } - } - $countCode[] = sprintf(' return %s;', implode(' + ', $operands)); - $countCode[] = ' }'; + $countCode[] = sprintf(' return %s;', implode(' + ', $operands)); + $countCode[] = ' }'; + } $code[] = sprintf(' }, %s)', count($operands) > 1 ? implode("\n", $countCode) : $operands[0]); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 05c549bcce2fe..3558c7bd226e1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -449,12 +449,17 @@ public function testCreateServiceWithIteratorArgument() $builder->register('bar', 'stdClass'); $builder ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))))) + ->setArguments(array( + new IteratorArgument(array('k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), + new IteratorArgument(array()), + )) ; $lazyContext = $builder->get('lazy_context'); $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); $this->assertCount(1, $lazyContext->lazyValues); + $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = 0; foreach ($lazyContext->lazyValues as $k => $v) { @@ -465,6 +470,13 @@ public function testCreateServiceWithIteratorArgument() // The second argument should have been ignored. $this->assertEquals(1, $i); + + $i = 0; + foreach ($lazyContext->lazyEmptyValues as $k => $v) { + ++$i; + } + + $this->assertEquals(0, $i); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index e2269538d4faf..744384b136f3a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -436,7 +436,10 @@ public function testLazyArgumentProvideGenerator() $container->register('lazy_referenced', 'stdClass'); $container ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))))) + ->setArguments(array( + new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))), + new IteratorArgument(array()), + )) ; $container->compile(); @@ -447,6 +450,9 @@ public function testLazyArgumentProvideGenerator() $lazyContext = $container->get('lazy_context'); $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); + $this->assertCount(2, $lazyContext->lazyValues); + $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = -1; foreach ($lazyContext->lazyValues as $k => $v) { @@ -461,6 +467,8 @@ public function testLazyArgumentProvideGenerator() break; } } + + $this->assertEmpty(iterator_to_array($lazyContext->lazyEmptyValues)); } public function testClosureProxy() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php index 9a18388be0574..2a31ec6d76e47 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -134,11 +134,11 @@ ; $container ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))))) + ->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array()))) ; $container ->register('lazy_context_ignore_invalid_ref', 'LazyContext') - ->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))))) + ->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), new IteratorArgument(array()))) ; $container ->register('closure_proxy', 'BarClass') diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 8ccbbcd438ca4..68fd01cf848b4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -102,9 +102,11 @@ public function getProxyCode(Definition $definition) class LazyContext { public $lazyValues; + public $lazyEmptyValues; - public function __construct($lazyValues) + public function __construct($lazyValues, $lazyEmptyValues) { $this->lazyValues = $lazyValues; + $this->lazyEmptyValues = $lazyEmptyValues; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index d59f315c2cfcb..b8d5aeafacf24 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -323,7 +323,9 @@ protected function getLazyContextService() return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () { yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->get('foo.baz')) && false ?: '_'}; yield 'k2' => $this; - }, 2)); + }, 2), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** @@ -343,7 +345,9 @@ protected function getLazyContextIgnoreInvalidRefService() } }, function () { return 1 + (int) ($this->has('invalid')); - })); + }), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index f35ca89f03e18..a519cece6e297 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -326,7 +326,9 @@ protected function getLazyContextService() return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () { yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->get('foo.baz')) && false ?: '_'}; yield 'k2' => $this; - }, 2)); + }, 2), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** @@ -341,7 +343,9 @@ protected function getLazyContextIgnoreInvalidRefService() { return $this->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () { yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->get('foo.baz')) && false ?: '_'}; - }, 1)); + }, 1), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml index 792c515995ed4..79fdff4c4e2d0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -121,12 +121,14 @@ + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index 519567054e074..bfee29fb605e5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -112,10 +112,10 @@ services: factory: ['@factory_simple', getInstance] lazy_context: class: LazyContext - arguments: [!iterator {'k1': '@foo.baz', 'k2': '@service_container'}] + arguments: [!iterator {'k1': '@foo.baz', 'k2': '@service_container'}, !iterator []] lazy_context_ignore_invalid_ref: class: LazyContext - arguments: [!iterator ['@foo.baz', '@?invalid']] + arguments: [!iterator ['@foo.baz', '@?invalid'], !iterator []] closure_proxy: class: BarClass arguments: [!closure_proxy ['@closure_proxy', getBaz]] diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 3a6e94aae08c4..41d1c48d54bcc 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -273,7 +273,7 @@ public function testParsesIteratorArgument() $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')))), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testParsesTags() @@ -659,7 +659,6 @@ public function testDefaults() $this->assertFalse($container->getDefinition('no_defaults')->isAutowired()); - $this->assertTrue($container->getDefinition('child_def')->isPublic()); $this->assertSame(array('foo' => array(array())), $container->getDefinition('child_def')->getTags()); $this->assertFalse($container->getDefinition('child_def')->isAutowired()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 8de64d55f4486..2c655d718998f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -346,7 +346,7 @@ public function testParsesIteratorArgument() $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')))), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testAutowire() From be60aa401fecc4ff054c597a6bae4d2df034b743 Mon Sep 17 00:00:00 2001 From: Chad Sikorra Date: Fri, 19 May 2017 13:02:26 -0500 Subject: [PATCH 10/75] [MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows --- src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php index 599940e8d7714..fb258808f3836 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php @@ -54,12 +54,12 @@ public function handle(array $record) $recordFormatted = $this->formatRecord($record); - if (!fwrite($this->socket, $recordFormatted)) { - fclose($this->socket); + if (-1 === stream_socket_sendto($this->socket, $recordFormatted)) { + stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR); // Let's retry: the persistent connection might just be stale if ($this->socket = $this->createSocket()) { - fwrite($this->socket, $recordFormatted); + stream_socket_sendto($this->socket, $recordFormatted); } } } finally { From c2ccf36040c3cbc6c00219d4e4840982a54da4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20F=C3=BChrer?= Date: Thu, 18 May 2017 09:29:28 +0200 Subject: [PATCH 11/75] [Intl] Fix bin/common.php PHP7 compatibility --- src/Symfony/Component/Intl/Resources/bin/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/Resources/bin/common.php b/src/Symfony/Component/Intl/Resources/bin/common.php index 2e3c026217737..051d253cf27a2 100644 --- a/src/Symfony/Component/Intl/Resources/bin/common.php +++ b/src/Symfony/Component/Intl/Resources/bin/common.php @@ -68,7 +68,7 @@ function get_icu_version_from_genrb($genrb) return $matches[1]; } -set_exception_handler(function (\Exception $exception) { +set_exception_handler(function (\Throwable $exception) { echo "\n"; $cause = $exception; From b973b3072a8911993715533f108137b7e649b032 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 18 May 2017 19:20:35 +0200 Subject: [PATCH 12/75] [Security][Serializer][DI] Add new arguments typehints in preparation for 4.0 --- UPGRADE-3.3.md | 2 +- UPGRADE-4.0.md | 2 +- .../Component/DependencyInjection/Compiler/Compiler.php | 4 ++-- .../Component/DependencyInjection/Compiler/PassConfig.php | 4 ++-- .../DependencyInjection/Compiler/ServiceReferenceGraph.php | 4 ++-- .../Component/DependencyInjection/ContainerBuilder.php | 4 ++-- .../Component/Security/Http/Logout/LogoutUrlGenerator.php | 4 ++-- .../Component/Serializer/Normalizer/AbstractNormalizer.php | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index 44044e73582fc..ae1985740f39b 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -303,7 +303,7 @@ Security * The `RoleInterface` has been deprecated. Extend the `Symfony\Component\Security\Core\Role\Role` class in your custom role implementations instead. - * The `LogoutUrlGenerator::registerListener()` method will expect a 6th `$context = null` argument in 4.0. + * The `LogoutUrlGenerator::registerListener()` method will expect a 6th `string $context = null` argument in 4.0. Define the argument when overriding this method. * The `AccessDecisionManager::setVoters()` method has been deprecated. Pass diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 6424371880704..4b040fd20318f 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -426,7 +426,7 @@ Security * The `RoleInterface` has been removed. Extend the `Symfony\Component\Security\Core\Role\Role` class instead. - * The `LogoutUrlGenerator::registerListener()` method expects a 6th `$context = null` argument. + * The `LogoutUrlGenerator::registerListener()` method expects a 6th `string $context = null` argument. * The `AccessDecisionManager::setVoters()` method has been removed. Pass the voters to the constructor instead. diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index 8a2ef34f5b8a8..43d65bdfd3c5b 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -77,7 +77,7 @@ public function getLoggingFormatter() * @param string $type The type of the pass * @param int $priority Used to sort the passes */ - public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/) + public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { if (func_num_args() >= 3) { $priority = func_get_arg(2); @@ -85,7 +85,7 @@ public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BE if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index a3ef360991a25..1e80a6060af61 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -108,7 +108,7 @@ public function getPasses() * * @throws InvalidArgumentException when a pass type doesn't exist */ - public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/) + public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { if (func_num_args() >= 3) { $priority = func_get_arg(2); @@ -116,7 +116,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php index 35733c72d0baa..193a37e20b0f6 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php @@ -86,7 +86,7 @@ public function clear() * @param string $reference * @param bool $lazy */ - public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, $lazy = false*/) + public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false*/) { if (func_num_args() >= 6) { $lazy = func_get_arg(5); @@ -94,7 +94,7 @@ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $re if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a 6th `$lazy = false` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a 6th `bool $lazy = false` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); } } $lazy = false; diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 30c8614b3e6a7..0a2d673c789df 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -448,7 +448,7 @@ public function loadFromExtension($extension, array $values = array()) * * @return $this */ - public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/) + public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { if (func_num_args() >= 3) { $priority = func_get_arg(2); @@ -456,7 +456,7 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig: if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php index 1c37229389946..3f2def8d735cc 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php @@ -48,7 +48,7 @@ public function __construct(RequestStack $requestStack = null, UrlGeneratorInter * @param CsrfTokenManagerInterface|null $csrfTokenManager A CsrfTokenManagerInterface instance * @param string|null $context The listener context */ - public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null/*, $context = null*/) + public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null/*, string $context = null*/) { if (func_num_args() >= 6) { $context = func_get_arg(5); @@ -56,7 +56,7 @@ public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a sixth `$context = null` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a sixth `string $context = null` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index db55db06dea56..97d9a5c9f68a4 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -302,7 +302,7 @@ protected function getConstructor(array &$data, $class, array &$context, \Reflec * * @throws RuntimeException */ - protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, $format = null*/) + protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, string $format = null*/) { if (func_num_args() >= 6) { $format = func_get_arg(5); @@ -310,7 +310,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s::%s() will have a 6th `$format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED); } } From 5bdda6ce746f338e908cc22b09fd64b172ecf04a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 May 2017 15:43:53 +0200 Subject: [PATCH 13/75] [Ldap] add a changelog file --- src/Symfony/Component/Ldap/CHANGELOG.md | 7 +++++++ src/Symfony/Component/Ldap/LdapClient.php | 2 +- src/Symfony/Component/Ldap/LdapClientInterface.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/Ldap/CHANGELOG.md diff --git a/src/Symfony/Component/Ldap/CHANGELOG.md b/src/Symfony/Component/Ldap/CHANGELOG.md new file mode 100644 index 0000000000000..61af4adf151a2 --- /dev/null +++ b/src/Symfony/Component/Ldap/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +3.1.0 +----- + + * The `LdapClient` class is deprecated. Use the `Ldap` class instead. diff --git a/src/Symfony/Component/Ldap/LdapClient.php b/src/Symfony/Component/Ldap/LdapClient.php index 0a68c05875b78..b20c7ea4828d5 100644 --- a/src/Symfony/Component/Ldap/LdapClient.php +++ b/src/Symfony/Component/Ldap/LdapClient.php @@ -18,7 +18,7 @@ * @author Francis Besset * @author Charles Sarrazin * - * @deprecated The LdapClient class will be removed in Symfony 4.0. You should use the Ldap class instead. + * @deprecated since version 3.1, to be removed in 4.0. Use the Ldap class instead. */ final class LdapClient implements LdapClientInterface { diff --git a/src/Symfony/Component/Ldap/LdapClientInterface.php b/src/Symfony/Component/Ldap/LdapClientInterface.php index 020e4b55896f5..0872ee082e813 100644 --- a/src/Symfony/Component/Ldap/LdapClientInterface.php +++ b/src/Symfony/Component/Ldap/LdapClientInterface.php @@ -19,7 +19,7 @@ * @author Grégoire Pineau * @author Charles Sarrazin * - * @deprecated You should use LdapInterface instead + * @deprecated since version 3.1, to be removed in 4.0. Use the LdapInterface instead. */ interface LdapClientInterface extends LdapInterface { From b3d58c54a4e40f1e57a33438ad8d2fa165e5389d Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sat, 20 May 2017 22:16:10 +0200 Subject: [PATCH 14/75] [DI] Added missing deprecation in changelog --- src/Symfony/Component/DependencyInjection/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md index 43f445736f55c..eddcd32eac864 100644 --- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -9,6 +9,7 @@ CHANGELOG * deprecated the ability to set or unset a private service with the `Container::set()` method * deprecated the ability to check for the existence of a private service with the `Container::has()` method * deprecated the ability to request a private service with the `Container::get()` method + * deprecated support for generating a dumped `Container` without populating the method map 3.0.0 ----- From a9202747095566037f0036a9bf2a3bc12cf1b83d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 09:37:18 +0200 Subject: [PATCH 15/75] do not mock a deprecated interface --- .../Provider/LdapBindAuthenticationProviderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php index 8c86f66494a5d..5611e111fd0b5 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php @@ -32,7 +32,7 @@ class LdapBindAuthenticationProviderTest extends TestCase public function testEmptyPasswordShouldThrowAnException() { $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); - $ldap = $this->getMockBuilder('Symfony\Component\Ldap\LdapClientInterface')->getMock(); + $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock(); $provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap); From c36ea03e687e60c6cf6f30bd5441ab64a34e9c26 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 10:03:01 +0200 Subject: [PATCH 16/75] [PhpUnitBridge] remove unused use statement --- src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php index f8814c3c844a7..173a0fa82fd93 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php @@ -16,7 +16,6 @@ use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestSuite; use PHPUnit\Util\Blacklist; -use PHPUnit\Util\Test; use Symfony\Bridge\PhpUnit\ClockMock; use Symfony\Bridge\PhpUnit\DnsMock; From f7d1a064c6abddb5d410206bf9a4bdef5a4fe320 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 10:33:50 +0200 Subject: [PATCH 17/75] respect optional error handler arguments --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 04abda4b9fa59..66b8762cff4e9 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -49,7 +49,7 @@ public static function register($mode = false) 'legacy' => array(), 'other' => array(), ); - $deprecationHandler = function ($type, $msg, $file, $line, $context) use (&$deprecations, $getMode) { + $deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode) { if (E_USER_DEPRECATED !== $type) { return \PHPUnit_Util_ErrorHandler::handleError($type, $msg, $file, $line, $context); } From 5ae84a07cc4d7e4147402b3639cf7f7ddeaa28c1 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 21 May 2017 11:46:19 +0200 Subject: [PATCH 18/75] update phpunit-bridge cache-id --- phpunit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit b/phpunit index 466f8fbbc2356..559660b1df25f 100755 --- a/phpunit +++ b/phpunit @@ -1,7 +1,7 @@ #!/usr/bin/env php Date: Sun, 21 May 2017 11:59:35 +0200 Subject: [PATCH 19/75] Add missing doc param & deprecation changelog entries --- src/Symfony/Bundle/SecurityBundle/CHANGELOG.md | 1 + src/Symfony/Component/HttpKernel/CHANGELOG.md | 1 + src/Symfony/Component/Translation/Translator.php | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md index 9691e5af03c16..4185d409fb445 100644 --- a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md @@ -10,6 +10,7 @@ CHANGELOG `ContainerAwareInterface` interface for this command. * Deprecated the `FirewallMap::$map` and `$container` properties. * [BC BREAK] Keys of the `users` node for `in_memory` user provider are no longer normalized. + * deprecated `FirewallContext::getListeners()` 3.2.0 ----- diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index 15c61d3829c0c..b963960fe0a4a 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG * added the possibility to change the query string parameter used by `UriSigner` * deprecated `LazyLoadingFragmentHandler::addRendererService()` * deprecated `Extension::addClassesToCompile()` + * deprecated `Psr6CacheClearer::addPool()` 3.2.0 ----- diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 5f8eb033040b7..44616350d14b9 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -74,10 +74,11 @@ class Translator implements TranslatorInterface, TranslatorBagInterface /** * Constructor. * - * @param string $locale The locale - * @param MessageSelector|null $selector The message selector for pluralization - * @param string|null $cacheDir The directory to use for the cache - * @param bool $debug Use cache in debug mode ? + * @param string $locale The locale + * @param MessageSelector|null $selector The message selector for pluralization + * @param string $defaultLocale + * @param string|null $cacheDir The directory to use for the cache + * @param bool $debug Use cache in debug mode ? * * @throws InvalidArgumentException If a locale contains invalid characters */ From f00c47ac9cef615883f5dcbea7a9c57b9b305784 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 12:07:34 +0200 Subject: [PATCH 20/75] document deprecation of the StringUtil class --- src/Symfony/Component/PropertyAccess/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/PropertyAccess/CHANGELOG.md b/src/Symfony/Component/PropertyAccess/CHANGELOG.md index 574106e521075..416287e2a0e82 100644 --- a/src/Symfony/Component/PropertyAccess/CHANGELOG.md +++ b/src/Symfony/Component/PropertyAccess/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +3.1.0 +----- + + * deprecated the `StringUtil` class, use `Symfony\Component\Inflector\Inflector` + instead + 2.7.0 ------ From 9a8ea931393d6cd4237fb615f4c614b1f03a5e89 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sun, 21 May 2017 12:19:15 +0200 Subject: [PATCH 21/75] [DI] Remove dead service_container checks --- .../Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php | 4 ---- .../Component/DependencyInjection/Dumper/GraphvizDumper.php | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index c081dfc6e96c6..268a7818979cb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -258,10 +258,6 @@ protected function resolveServiceDefinition(ContainerBuilder $builder, $serviceI return $builder->getAlias($serviceId); } - if ('service_container' === $serviceId) { - return $builder; - } - // the service has been injected in some special way, just return the service return $builder->get($serviceId); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php index 9a20525f626c0..25ab3078c9a2a 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php @@ -192,8 +192,7 @@ private function findNodes() } if (!$container->hasDefinition($id)) { - $class = get_class('service_container' === $id ? $this->container : $container->get($id)); - $nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => $this->options['node.instance']); + $nodes[$id] = array('class' => str_replace('\\', '\\\\', get_class($container->get($id))), 'attributes' => $this->options['node.instance']); } } From 57f6941e25891131b2878ba6f3e50fc4dfb34642 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 14:39:29 +0200 Subject: [PATCH 22/75] [Yaml] fix colon without space deprecation A colon after a mapping key that is not followed by a space is valid if the mapping key is quoted. --- src/Symfony/Component/Yaml/CHANGELOG.md | 4 ++-- src/Symfony/Component/Yaml/Inline.php | 5 +++-- src/Symfony/Component/Yaml/Tests/InlineTest.php | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Yaml/CHANGELOG.md b/src/Symfony/Component/Yaml/CHANGELOG.md index 1a112f1230d32..a664d4b1eb3d6 100644 --- a/src/Symfony/Component/Yaml/CHANGELOG.md +++ b/src/Symfony/Component/Yaml/CHANGELOG.md @@ -5,8 +5,8 @@ CHANGELOG ----- * Mappings with a colon (`:`) that is not followed by a whitespace are deprecated - and will lead to a `ParseException` in Symfony 4.0 (e.g. `foo:bar` must be - `foo: bar`). + when the mapping key is not quoted and will lead to a `ParseException` in + Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`). * Added support for parsing PHP constants: diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index b5136b3ab7cb1..e9a5955bbadab 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -461,14 +461,15 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar } // key + $isKeyQuoted = in_array($mapping[$i], array('"', "'"), true); $key = self::parseScalar($mapping, $flags, array(':', ' '), array('"', "'"), $i, false); if (':' !== $key && false === $i = strpos($mapping, ':', $i)) { break; } - if (':' !== $key && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) { - @trigger_error('Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED); + if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) { + @trigger_error('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED); } // value diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index bfa13e09d74e7..09175a6881d46 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -168,7 +168,7 @@ public function testParseInvalidMappingKeyShouldThrowException() /** * @group legacy - * @expectedDeprecation Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0. + * @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0. * throws \Symfony\Component\Yaml\Exception\ParseException in 4.0 */ public function testParseMappingKeyWithColonNotFollowedBySpace() @@ -391,6 +391,8 @@ public function getTestsForParse() array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')), array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')), array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')), + array('{"foo:bar": "baz"}', array('foo:bar' => 'baz')), + array('{"foo":"bar"}', array('foo' => 'bar')), // nested sequences and mappings array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))), @@ -460,6 +462,8 @@ public function getTestsForParseWithMapObjects() array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')), array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')), array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')), + array('{"foo:bar": "baz"}', (object) array('foo:bar' => 'baz')), + array('{"foo":"bar"}', (object) array('foo' => 'bar')), // nested sequences and mappings array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))), From df747ce43f9b5d16499186c3e1007b09b586779f Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 20 May 2017 20:02:01 +0200 Subject: [PATCH 23/75] [FrameworkBundle][Validator] Deprecate passing validator instances/aliases over using the service locator --- UPGRADE-3.3.md | 4 +++ UPGRADE-4.0.md | 4 +++ .../Bundle/FrameworkBundle/CHANGELOG.md | 1 + .../ConstraintValidatorFactoryTest.php | 35 +++++++++++++++++++ .../Validator/ConstraintValidatorFactory.php | 16 +++++---- 5 files changed, 53 insertions(+), 7 deletions(-) diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index ae1985740f39b..3734fff5e29a8 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -244,6 +244,10 @@ FrameworkBundle class has been deprecated and will be removed in 4.0. Use the `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` class instead. + * Passing an array of validators or validator aliases as the second argument of + `ConstraintValidatorFactory::__construct()` is deprecated since 3.3 and will + be removed in 4.0. Use the service locator instead. + HttpFoundation -------------- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 4b040fd20318f..0f89d2b3b791f 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -299,6 +299,10 @@ FrameworkBundle * Extending `ConstraintValidatorFactory` is not supported anymore. + * Passing an array of validators or validator aliases as the second argument of + `ConstraintValidatorFactory::__construct()` has been removed. + Use the service locator instead. + * Class parameters related to routing have been removed * router.options.generator_class * router.options.generator_base_class diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index df80163243c1c..b7473b58129bf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -49,6 +49,7 @@ CHANGELOG `Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` instead * Deprecated `ValidateWorkflowsPass`, use `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` instead + * Deprecated `ConstraintValidatorFactory::__construct()` second argument. 3.2.0 ----- diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php index 6cf9574ece96b..38a1190aded74 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php @@ -14,7 +14,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Blank as BlankConstraint; +use Symfony\Component\Validator\ConstraintValidator; class ConstraintValidatorFactoryTest extends TestCase { @@ -41,6 +44,38 @@ public function testGetInstanceReturnsExistingValidator() } public function testGetInstanceReturnsService() + { + $service = 'validator_constraint_service'; + $validator = $this->getMockForAbstractClass(ConstraintValidator::class); + + // mock ContainerBuilder b/c it implements TaggedContainerInterface + $container = $this->getMockBuilder(ContainerBuilder::class)->setMethods(array('get', 'has'))->getMock(); + $container + ->expects($this->once()) + ->method('get') + ->with($service) + ->willReturn($validator); + $container + ->expects($this->once()) + ->method('has') + ->with($service) + ->willReturn(true); + + $constraint = $this->getMockBuilder(Constraint::class)->getMock(); + $constraint + ->expects($this->once()) + ->method('validatedBy') + ->will($this->returnValue($service)); + + $factory = new ConstraintValidatorFactory($container); + $this->assertSame($validator, $factory->getInstance($constraint)); + } + + /** + * @group legacy + * @expectedDeprecation Passing an array of validators or validator aliases as the second argument of "Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory::__construct" is deprecated since 3.3 and will be removed in 4.0. Use the service locator instead. + */ + public function testGetInstanceReturnsServiceWithAlias() { $service = 'validator_constraint_service'; $alias = 'validator_constraint_alias'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php index aba02e0944e22..49cd5fe1138cb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php +++ b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php @@ -45,15 +45,16 @@ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface protected $container; protected $validators; - /** - * Constructor. - * - * @param ContainerInterface $container The service container - * @param array $validators An array of validators - */ - public function __construct(ContainerInterface $container, array $validators = array()) + public function __construct(ContainerInterface $container, array $validators = null) { $this->container = $container; + + if (null !== $validators) { + @trigger_error(sprintf('Passing an array of validators or validator aliases as the second argument of "%s" is deprecated since 3.3 and will be removed in 4.0. Use the service locator instead.', __METHOD__), E_USER_DEPRECATED); + } else { + $validators = array(); + } + $this->validators = $validators; } @@ -82,6 +83,7 @@ public function getInstance(Constraint $constraint) $this->validators[$name] = new $name(); } } elseif (is_string($this->validators[$name])) { + // To be removed in 4.0 $this->validators[$name] = $this->container->get($this->validators[$name]); } From 50fdcd6c4f40fb9a97515b34d1b1e60096a6422f Mon Sep 17 00:00:00 2001 From: Brandon Kelly Date: Sun, 21 May 2017 07:18:42 -0700 Subject: [PATCH 24/75] Fixed filename in help text for update-data.php --- src/Symfony/Component/Intl/Resources/bin/update-data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/Resources/bin/update-data.php b/src/Symfony/Component/Intl/Resources/bin/update-data.php index fe527efeccc11..0914d26ec608e 100644 --- a/src/Symfony/Component/Intl/Resources/bin/update-data.php +++ b/src/Symfony/Component/Intl/Resources/bin/update-data.php @@ -36,7 +36,7 @@ if ($argc > 3 || 2 === $argc && '-h' === $argv[1]) { bailout(<<<'MESSAGE' -Usage: php update-icu-component.php +Usage: php update-data.php Updates the ICU data for Symfony to the latest version of ICU. From c83c5bc6b18acd4079c6d5993a65a2c96e27fb53 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 19:39:57 +0200 Subject: [PATCH 25/75] [PhpUnitBridge] add changelog entries for #21140 --- src/Symfony/Bridge/PhpUnit/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/Symfony/Bridge/PhpUnit/CHANGELOG.md diff --git a/src/Symfony/Bridge/PhpUnit/CHANGELOG.md b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md new file mode 100644 index 0000000000000..daaa369e499b9 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md @@ -0,0 +1,10 @@ +CHANGELOG +========= + +3.3.0 +----- + + * using the `testLegacy` prefix in method names to mark a test as legacy is + deprecated, use the `@group legacy` notation instead + * using the `Legacy` prefix in class names to mark a test as legacy is deprecated, + use the `@group legacy` notation instead From e5455db84f668c1e69944283eedf01cb940895a7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 19:48:19 +0200 Subject: [PATCH 26/75] [PhpUnitBridge] add a changelog file --- src/Symfony/Bridge/PhpUnit/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/Symfony/Bridge/PhpUnit/CHANGELOG.md diff --git a/src/Symfony/Bridge/PhpUnit/CHANGELOG.md b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md new file mode 100644 index 0000000000000..950b2389113b0 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md @@ -0,0 +1,8 @@ +CHANGELOG +========= + +3.1.0 +----- + + * passing a numerically indexed array to the constructor of the `SymfonyTestsListenerTrait` + is deprecated, pass an array of namespaces indexed by the mocked feature instead From 1c2383f1a5c8b210afad0c95e24243a813e6648d Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Sun, 21 May 2017 23:03:33 +0200 Subject: [PATCH 27/75] [DependencyInjection] remove unused variable --- .../Component/DependencyInjection/Compiler/AutowirePass.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 0a6a0dfc1b6b3..b79a656aa8eaf 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -163,7 +163,6 @@ private function doProcessValue($value, $isRoot = false) */ private function getMethodsToAutowire(\ReflectionClass $reflectionClass) { - $found = array(); $methodsToAutowire = array(); foreach ($reflectionClass->getMethods() as $reflectionMethod) { From a8e298a66cba3ce04c80a849635d80955250231d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 8 May 2017 13:12:11 +0200 Subject: [PATCH 28/75] use getProjectDir() when possible --- .../Bundle/FrameworkBundle/Command/AboutCommand.php | 7 +++---- .../FrameworkBundle/Command/AssetsInstallCommand.php | 4 +--- .../Bundle/WebServerBundle/Resources/config/webserver.xml | 4 ++-- src/Symfony/Bundle/WebServerBundle/composer.json | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index 76705f08d5e7d..6db6da85e065a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -46,7 +46,6 @@ protected function execute(InputInterface $input, OutputInterface $output) /** @var $kernel KernelInterface */ $kernel = $this->getContainer()->get('kernel'); - $baseDir = realpath($kernel->getRootDir().DIRECTORY_SEPARATOR.'..'); $io->table(array(), array( array('Symfony'), @@ -62,9 +61,9 @@ protected function execute(InputInterface $input, OutputInterface $output) array('Environment', $kernel->getEnvironment()), array('Debug', $kernel->isDebug() ? 'true' : 'false'), array('Charset', $kernel->getCharset()), - array('Root directory', self::formatPath($kernel->getRootDir(), $baseDir)), - array('Cache directory', self::formatPath($kernel->getCacheDir(), $baseDir).' ('.self::formatFileSize($kernel->getCacheDir()).')'), - array('Log directory', self::formatPath($kernel->getLogDir(), $baseDir).' ('.self::formatFileSize($kernel->getLogDir()).')'), + array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())), + array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' ('.self::formatFileSize($kernel->getCacheDir()).')'), + array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' ('.self::formatFileSize($kernel->getLogDir()).')'), new TableSeparator(), array('PHP'), new TableSeparator(), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index feb966d850939..136b1c21fae98 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -82,9 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $targetArg = rtrim($input->getArgument('target'), '/'); if (!is_dir($targetArg)) { - $appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..'; - - $targetArg = $appRoot.'/'.$targetArg; + $targetArg = $this->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg; if (!is_dir($targetArg)) { throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target'))); diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml index c45fff0a23d4a..2815c6d2cfbf5 100644 --- a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml +++ b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml @@ -8,13 +8,13 @@ - %kernel.root_dir%/../web + %kernel.project_dir%/web %kernel.environment% - %kernel.root_dir%/../web + %kernel.project_dir%/web %kernel.environment% diff --git a/src/Symfony/Bundle/WebServerBundle/composer.json b/src/Symfony/Bundle/WebServerBundle/composer.json index c87dab356e2d4..ce8a60d136eb0 100644 --- a/src/Symfony/Bundle/WebServerBundle/composer.json +++ b/src/Symfony/Bundle/WebServerBundle/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.5.9", "symfony/console": "~2.8.8|~3.0.8|~3.1.2|~3.2", - "symfony/http-kernel": "~2.8|~3.0", + "symfony/http-kernel": "~3.3", "symfony/process": "~2.8|~3.0" }, "autoload": { From a9c11c9b201cb5bd2892fb8b8db285bd6d6669ff Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Mon, 22 May 2017 09:32:45 +0200 Subject: [PATCH 29/75] avoid double blanks while rendering form attributes --- .../Twig/Resources/views/Form/form_div_layout.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 82d52706d9a1a..51e13a843033f 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -79,7 +79,7 @@ {{- block('choice_widget_options') -}} {%- else -%} - + {%- endif -%} {% endfor %} {%- endblock choice_widget_options -%} @@ -259,7 +259,7 @@ {% set label = name|humanize %} {%- endif -%} {%- endif -%} - {{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }} + {{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }} {%- endif -%} {%- endblock form_label -%} From 082996417daa10def5166f9829c8bd84a0212179 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 May 2017 09:42:36 +0200 Subject: [PATCH 30/75] fix docblock position The `$defaultLocale` argument is present in the `Translator` class of the FrameworkBundle, but is not part of the Translation component. --- .../Bundle/FrameworkBundle/Translation/Translator.php | 9 +++++---- src/Symfony/Component/Translation/Translator.php | 9 ++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 6bcbaa8e97416..2b83e14b10e66 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -48,10 +48,11 @@ class Translator extends BaseTranslator implements WarmableInterface * * debug: Whether to enable debugging or not (false by default) * * resource_files: List of translation resources available grouped by locale. * - * @param ContainerInterface $container A ContainerInterface instance - * @param MessageSelector $selector The message selector for pluralization - * @param array $loaderIds An array of loader Ids - * @param array $options An array of options + * @param ContainerInterface $container A ContainerInterface instance + * @param MessageSelector $selector The message selector for pluralization + * @param string $defaultLocale + * @param array $loaderIds An array of loader Ids + * @param array $options An array of options * * @throws InvalidArgumentException */ diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 44616350d14b9..5f8eb033040b7 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -74,11 +74,10 @@ class Translator implements TranslatorInterface, TranslatorBagInterface /** * Constructor. * - * @param string $locale The locale - * @param MessageSelector|null $selector The message selector for pluralization - * @param string $defaultLocale - * @param string|null $cacheDir The directory to use for the cache - * @param bool $debug Use cache in debug mode ? + * @param string $locale The locale + * @param MessageSelector|null $selector The message selector for pluralization + * @param string|null $cacheDir The directory to use for the cache + * @param bool $debug Use cache in debug mode ? * * @throws InvalidArgumentException If a locale contains invalid characters */ From c252c08d44ec38ccc99070bb1f42c4b5b8d2c4dd Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 22 May 2017 11:10:57 +0200 Subject: [PATCH 31/75] Fixed extra semi-colon --- src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 9811eab5e7e48..8e86b054c05b0 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -51,7 +51,6 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, unset($v->value['position'], $v->value['isVariadic'], $v->value['byReference'], $v); } } - ; if (!($filter & Caster::EXCLUDE_VERBOSE) && $f = $c->getFileName()) { $a[$prefix.'file'] = new LinkStub($f, $c->getStartLine()); From 987749bb999e9841e37f6422c3319b9b00f24ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 22 May 2017 11:36:51 +0200 Subject: [PATCH 32/75] [Serializer] Remove a useless legacy annotation --- .../Tests/Normalizer/AbstractObjectNormalizerTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 4f9268bd174eb..1040111cfe620 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -26,9 +26,6 @@ public function testDenormalize() $this->assertSame('baz', $normalizedData->baz); } - /** - * @group legacy - */ public function testInstantiateObjectDenormalizer() { $data = array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'); From 49d6604ee4bd89a5d63b370151536722cf70392c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 22 May 2017 13:36:46 +0200 Subject: [PATCH 33/75] Fix file perms --- src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php | 0 src/Symfony/Component/Finder/Tests/GlobTest.php | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php mode change 100755 => 100644 src/Symfony/Component/Finder/Tests/GlobTest.php diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php old mode 100755 new mode 100644 diff --git a/src/Symfony/Component/Finder/Tests/GlobTest.php b/src/Symfony/Component/Finder/Tests/GlobTest.php old mode 100755 new mode 100644 From 26032ef055ad6a7c3d5bb7ca8bb4b5b610ca50a8 Mon Sep 17 00:00:00 2001 From: maryo Date: Tue, 2 May 2017 20:18:44 +0200 Subject: [PATCH 34/75] [Process] Fixed incorrectly escaping arguments on Windows when inheritEnvironmentVariables is set to false --- src/Symfony/Component/Process/Process.php | 17 +++++++++++------ .../Component/Process/Tests/ProcessTest.php | 13 +++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index a709f4a61d26c..fb12d393abad7 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -320,7 +320,7 @@ public function start(callable $callback = null/*, array $env = array()*/) } if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) { $this->options['bypass_shell'] = true; - $commandline = $this->prepareWindowsCommandLine($commandline, $envBackup); + $commandline = $this->prepareWindowsCommandLine($commandline, $envBackup, $env); } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { // last exit code is output on the fourth pipe and caught to work around --enable-sigchild $descriptors[3] = array('pipe', 'w'); @@ -1627,7 +1627,7 @@ private function doSignal($signal, $throwException) return true; } - private function prepareWindowsCommandLine($cmd, array &$envBackup) + private function prepareWindowsCommandLine($cmd, array &$envBackup, array &$env = null) { $uid = uniqid('', true); $varCount = 0; @@ -1640,7 +1640,7 @@ private function prepareWindowsCommandLine($cmd, array &$envBackup) [^"%!^]*+ )++ )"/x', - function ($m) use (&$envBackup, &$varCache, &$varCount, $uid) { + function ($m) use (&$envBackup, &$env, &$varCache, &$varCount, $uid) { if (isset($varCache[$m[0]])) { return $varCache[$m[0]]; } @@ -1652,10 +1652,15 @@ function ($m) use (&$envBackup, &$varCache, &$varCount, $uid) { } $value = str_replace(array('!LF!', '"^!"', '"^%"', '"^^"', '""'), array("\n", '!', '%', '^', '"'), $value); - $value = preg_replace('/(\\\\*)"/', '$1$1\\"', $value); - + $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"'; $var = $uid.++$varCount; - putenv("$var=\"$value\""); + + if (null === $env) { + putenv("$var=$value"); + } else { + $env[$var] = $value; + } + $envBackup[$var] = false; return $varCache[$m[0]] = '!'.$var.'!'; diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index 642df9c4a3c08..ade11138e3b60 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1465,6 +1465,19 @@ public function testEscapeArgument($arg) $this->assertSame($arg, $p->getOutput()); } + /** + * @dataProvider provideEscapeArgument + * @group legacy + */ + public function testEscapeArgumentWhenInheritEnvDisabled($arg) + { + $p = new Process(array(self::$phpBin, '-r', 'echo $argv[1];', $arg), null, array('BAR' => 'BAZ')); + $p->inheritEnvironmentVariables(false); + $p->run(); + + $this->assertSame($arg, $p->getOutput()); + } + public function provideEscapeArgument() { yield array('a"b%c%'); From b39b35b95dedb73bbdb2936546c4f7339b077e1d Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 22 May 2017 18:25:24 +0200 Subject: [PATCH 35/75] Prevent auto-registration of UserPasswordEncoderCommand --- .../DependencyInjection/SecurityExtension.php | 8 ++++---- .../DependencyInjection/CompleteConfigurationTest.php | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index a54244d67c663..4191506f1ece3 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -98,11 +98,11 @@ public function load(array $configs, ContainerBuilder $container) if ($config['encoders']) { $this->createEncoders($config['encoders'], $container); + } - if (class_exists(Application::class)) { - $loader->load('console.xml'); - $container->getDefinition('security.console.user_password_encoder_command')->replaceArgument(1, array_keys($config['encoders'])); - } + if (class_exists(Application::class)) { + $loader->load('console.xml'); + $container->getDefinition('security.console.user_password_encoder_command')->replaceArgument(1, array_keys($config['encoders'])); } // load ACL diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index bfa0f1b877b28..6ef0e305ec4f6 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -345,6 +345,11 @@ public function testUserCheckerConfigWithNoCheckers() $this->assertEquals('security.user_checker', $this->getContainer('container1')->getAlias('security.user_checker.secure')); } + public function testUserPasswordEncoderCommandIsRegistered() + { + $this->assertTrue($this->getContainer('remember_me_options')->has('security.console.user_password_encoder_command')); + } + protected function getContainer($file) { $file = $file.'.'.$this->getFileExtension(); From 98b3002caff4d74cc9c8488bfae777113c6f40fc Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Mon, 22 May 2017 19:32:12 +0200 Subject: [PATCH 36/75] [Profiler][VarDumper] Fix searchbar css when in toolbar --- .../Resources/views/Profiler/toolbar.css.twig | 3 +++ .../Component/VarDumper/Dumper/HtmlDumper.php | 20 +++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index 4092f7547aed6..3a8f6e0fbadc9 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -382,6 +382,9 @@ .sf-toolbar-block-dump pre.sf-dump:last-child { margin-bottom: 0; } +.sf-toolbar-block-dump pre.sf-dump .sf-dump-search-wrapper { + margin-bottom: 5px; +} .sf-toolbar-block-dump pre.sf-dump span.sf-dump-search-count { color: #333; font-size: 12px; diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 8b82c51d11e7c..cf94b1af93039 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -655,17 +655,17 @@ function showCurrent(state) border: 1px solid #ffa500; border-radius: 3px; } -.sf-dump-search-hidden { +pre.sf-dump .sf-dump-search-hidden { display: none; } -.sf-dump-search-wrapper { +pre.sf-dump .sf-dump-search-wrapper { float: right; font-size: 0; white-space: nowrap; max-width: 100%; text-align: right; } -.sf-dump-search-wrapper > * { +pre.sf-dump .sf-dump-search-wrapper > * { vertical-align: top; box-sizing: border-box; height: 21px; @@ -675,7 +675,7 @@ function showCurrent(state) color: #757575; border: 1px solid #BBB; } -.sf-dump-search-wrapper > input.sf-dump-search-input { +pre.sf-dump .sf-dump-search-wrapper > input.sf-dump-search-input { padding: 3px; height: 21px; font-size: 12px; @@ -685,25 +685,25 @@ function showCurrent(state) border-bottom-left-radius: 3px; color: #000; } -.sf-dump-search-wrapper > .sf-dump-search-input-next, -.sf-dump-search-wrapper > .sf-dump-search-input-previous { +pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next, +pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous { background: #F2F2F2; outline: none; border-left: none; font-size: 0; line-height: 0; } -.sf-dump-search-wrapper > .sf-dump-search-input-next { +pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next { border-top-right-radius: 3px; border-bottom-right-radius: 3px; } -.sf-dump-search-wrapper > .sf-dump-search-input-next > svg, -.sf-dump-search-wrapper > .sf-dump-search-input-previous > svg { +pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next > svg, +pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous > svg { pointer-events: none; width: 12px; height: 12px; } -.sf-dump-search-wrapper > .sf-dump-search-count { +pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-count { display: inline-block; padding: 0 5px; margin: 0; From 36f6e05a2e51fbce2b25b3cdd75979547a39f73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Mon, 22 May 2017 22:45:58 +0200 Subject: [PATCH 37/75] Close PHP code in phpt file --- .../Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt index 7bbda8775d6d5..7e9c6f8ed7682 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt @@ -17,6 +17,8 @@ require PHPUNIT_COMPOSER_INSTALL; require_once __DIR__.'/../../bootstrap.php'; require __DIR__.'/fake_vendor/autoload.php'; require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php'; + +?> --EXPECTF-- Unsilenced deprecation notices (2) From 4bcef3d67c23e6006cbe8516e7951e51d8810376 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 22 May 2017 10:33:24 -0400 Subject: [PATCH 38/75] [DI] Fix autowire error for inlined services --- .../Compiler/AutowireExceptionPass.php | 20 ++++++-- .../Compiler/InlineServiceDefinitionsPass.php | 12 +++++ .../Compiler/PassConfig.php | 4 +- .../Compiler/AutowireExceptionPassTest.php | 46 ++++++++++++++++++- .../InlineServiceDefinitionsPassTest.php | 24 ++++++++++ 5 files changed, 99 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php index 31e407cd630a8..2ee9427a15098 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php @@ -21,16 +21,30 @@ class AutowireExceptionPass implements CompilerPassInterface { private $autowirePass; + private $inlineServicePass; - public function __construct(AutowirePass $autowirePass) + public function __construct(AutowirePass $autowirePass, InlineServiceDefinitionsPass $inlineServicePass) { $this->autowirePass = $autowirePass; + $this->inlineServicePass = $inlineServicePass; } public function process(ContainerBuilder $container) { - foreach ($this->autowirePass->getAutowiringExceptions() as $exception) { - if ($container->hasDefinition($exception->getServiceId())) { + // the pass should only be run once + if (null === $this->autowirePass || null === $this->inlineServicePass) { + return; + } + + $inlinedIds = $this->inlineServicePass->getInlinedServiceIds(); + $exceptions = $this->autowirePass->getAutowiringExceptions(); + + // free up references + $this->autowirePass = null; + $this->inlineServicePass = null; + + foreach ($exceptions as $exception) { + if ($container->hasDefinition($exception->getServiceId()) || in_array($exception->getServiceId(), $inlinedIds)) { throw $exception; } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index cec68cbb573a1..b084d7e4dce28 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -23,6 +23,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface { private $repeatedPass; + private $inlinedServiceIds = array(); /** * {@inheritdoc} @@ -32,6 +33,16 @@ public function setRepeatedPass(RepeatedPass $repeatedPass) $this->repeatedPass = $repeatedPass; } + /** + * Returns an array of all services inlined by this pass. + * + * @return array Service id strings + */ + public function getInlinedServiceIds() + { + return $this->inlinedServiceIds; + } + /** * {@inheritdoc} */ @@ -46,6 +57,7 @@ protected function processValue($value, $isRoot = false) if ($this->isInlineableDefinition($id, $definition, $this->container->getCompiler()->getServiceReferenceGraph())) { $this->container->log($this, sprintf('Inlined service "%s" to "%s".', $id, $this->currentId)); + $this->inlinedServiceIds[] = $id; if ($definition->isShared()) { return $definition; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index 1e80a6060af61..5ee8f98851438 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -73,11 +73,11 @@ public function __construct() new RemoveAbstractDefinitionsPass(), new RepeatedPass(array( new AnalyzeServiceReferencesPass(), - new InlineServiceDefinitionsPass(), + $inlinedServicePass = new InlineServiceDefinitionsPass(), new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass(), )), - new AutowireExceptionPass($autowirePass), + new AutowireExceptionPass($autowirePass, $inlinedServicePass), new CheckExceptionOnInvalidReferenceBehaviorPass(), )); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php index 4859db3a64e0f..092b6401c48ef 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Compiler\AutowireExceptionPass; use Symfony\Component\DependencyInjection\Compiler\AutowirePass; +use Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException; @@ -29,10 +30,45 @@ public function testThrowsException() ->method('getAutowiringExceptions') ->will($this->returnValue(array($autowireException))); + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) + ->getMock(); + $inlinePass->expects($this->any()) + ->method('getInlinedServiceIds') + ->will($this->returnValue(array())); + $container = new ContainerBuilder(); $container->register('foo_service_id'); - $pass = new AutowireExceptionPass($autowirePass); + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); + + try { + $pass->process($container); + $this->fail('->process() should throw the exception if the service id exists'); + } catch (\Exception $e) { + $this->assertSame($autowireException, $e); + } + } + + public function testThrowExceptionIfServiceInlined() + { + $autowirePass = $this->getMockBuilder(AutowirePass::class) + ->getMock(); + + $autowireException = new AutowiringFailedException('foo_service_id', 'An autowiring exception message'); + $autowirePass->expects($this->any()) + ->method('getAutowiringExceptions') + ->will($this->returnValue(array($autowireException))); + + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) + ->getMock(); + $inlinePass->expects($this->any()) + ->method('getInlinedServiceIds') + ->will($this->returnValue(array('foo_service_id'))); + + // don't register the foo_service_id service + $container = new ContainerBuilder(); + + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); try { $pass->process($container); @@ -52,9 +88,15 @@ public function testNoExceptionIfServiceRemoved() ->method('getAutowiringExceptions') ->will($this->returnValue(array($autowireException))); + $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) + ->getMock(); + $inlinePass->expects($this->any()) + ->method('getInlinedServiceIds') + ->will($this->returnValue(array())); + $container = new ContainerBuilder(); - $pass = new AutowireExceptionPass($autowirePass); + $pass = new AutowireExceptionPass($autowirePass, $inlinePass); $pass->process($container); // mark the test as passed diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php index c5e7272235f9f..d241758b04425 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -252,6 +252,30 @@ public function testProcessDoesNotSetLazyArgumentValuesAfterInlining() $this->assertSame('inline', (string) $values[0]); } + public function testGetInlinedServiceIds() + { + $container = new ContainerBuilder(); + $container + ->register('inlinable.service') + ->setPublic(false) + ; + $container + ->register('non_inlinable.service') + ->setPublic(true) + ; + + $container + ->register('service') + ->setArguments(array(new Reference('inlinable.service'))) + ; + + $inlinePass = new InlineServiceDefinitionsPass(); + $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), $inlinePass)); + $repeatedPass->process($container); + + $this->assertEquals(array('inlinable.service'), $inlinePass->getInlinedServiceIds()); + } + protected function process(ContainerBuilder $container) { $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass())); From c91d19574f851960f4f87919c9df578e81e4c1bc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 May 2017 11:11:47 +0200 Subject: [PATCH 39/75] [WebServerBundle] Mark ServerCommand as internal --- src/Symfony/Bundle/WebServerBundle/Command/ServerCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerCommand.php index 40a0da6e08bce..1df81a68a173b 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerCommand.php @@ -17,6 +17,8 @@ * Base methods for commands related to a local web server. * * @author Christian Flothmann + * + * @internal */ abstract class ServerCommand extends Command { From fadffad2aae528962f844cdf2f96fe0a67593eb3 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 May 2017 13:48:44 +0200 Subject: [PATCH 40/75] [FrameworkBundle] Handle project dir in cache:clear command --- .../Bundle/FrameworkBundle/Command/CacheClearCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 49284270e6e34..02aad425c2353 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -201,6 +201,7 @@ protected function getTempKernel(KernelInterface $parent, $namespace, $parentCla { $cacheDir = var_export($warmupDir, true); $rootDir = var_export(realpath($parent->getRootDir()), true); + $projectDir = var_export(realpath($parent->getProjectDir()), true); $logDir = var_export(realpath($parent->getLogDir()), true); // the temp kernel class name must have the same length than the real one // to avoid the many problems in serialized resources files @@ -224,6 +225,11 @@ public function getRootDir() return $rootDir; } + public function getProjectDir() + { + return $projectDir; + } + public function getLogDir() { return $logDir; From d715cc4a27e23d3468f16c2c57deb336f3ad323d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 May 2017 15:50:11 +0200 Subject: [PATCH 41/75] [WebProfilerBundle] Fix sub-requests display in time profiler panel --- .../Resources/views/Collector/time.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig index ea73c8bde717e..28e3a3c8385af 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig @@ -107,8 +107,8 @@ {% if profile.parent %} -

- Sub-Request {{ profile.getcollector('request').requestattributes.get('_controller') }} +

+ Sub-Request {{ profiler_dump(profile.getcollector('request').requestattributes.get('_controller')) }} {{ collector.events.__section__.duration }} ms Return to parent request From 4f683a9a5b745b9a00de01b80c3ec9e208221aec Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Tue, 23 May 2017 09:27:52 +0200 Subject: [PATCH 42/75] [DI] Check for privates before shared services --- UPGRADE-3.2.md | 9 ++++++++ .../WebProfilerExtensionTest.php | 7 +++++-- .../DependencyInjection/Container.php | 15 ++++++------- .../DependencyInjection/ContainerBuilder.php | 3 --- .../Tests/ContainerTest.php | 21 +++++++++++++++---- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/UPGRADE-3.2.md b/UPGRADE-3.2.md index e151275472755..8a14f2d4b6281 100644 --- a/UPGRADE-3.2.md +++ b/UPGRADE-3.2.md @@ -64,6 +64,15 @@ DependencyInjection * Calling `get()` on a `ContainerBuilder` instance before compiling the container is deprecated and will throw an exception in Symfony 4.0. + * Setting or unsetting a private service with the `Container::set()` method is + deprecated. Only public services can be set or unset in Symfony 4.0. + + * Checking the existence of a private service with the `Container::has()` + method is deprecated and will return `false` in Symfony 4.0. + + * Requesting a private service with the `Container::get()` method is deprecated + and will no longer be supported in Symfony 4.0. + ExpressionLanguage ------------------- diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php index b5a9b53e5dbdc..28dbb976d3fbb 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -27,10 +27,13 @@ class WebProfilerExtensionTest extends TestCase */ private $container; - public static function assertSaneContainer(Container $container, $message = '') + public static function assertSaneContainer(Container $container, $message = '', $knownPrivates = array()) { $errors = array(); foreach ($container->getServiceIds() as $id) { + if (in_array($id, $knownPrivates, true)) { // to be removed in 4.0 + continue; + } try { $container->get($id); } catch (\Exception $e) { @@ -98,7 +101,7 @@ public function testToolbarConfig($toolbarEnabled, $interceptRedirects, $listene $this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar')); - $this->assertSaneContainer($this->getDumpedContainer()); + $this->assertSaneContainer($this->getDumpedContainer(), '', array('web_profiler.csp.handler')); if ($listenerInjected) { $this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled()); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index da84d18acffa3..119fb432a321b 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -200,6 +200,10 @@ public function set($id, $service) public function has($id) { for ($i = 2;;) { + if (isset($this->privates[$id])) { + @trigger_error(sprintf('Checking for the existence of the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); + } + if ('service_container' === $id || isset($this->aliases[$id]) || isset($this->services[$id]) @@ -207,10 +211,6 @@ public function has($id) return true; } - if (isset($this->privates[$id])) { - @trigger_error(sprintf('Checking for the existence of the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); - } - if (isset($this->methodMap[$id])) { return true; } @@ -262,6 +262,10 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } + if (isset($this->privates[$id])) { + @trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); + } + // Re-use shared service instance if it exists. if (isset($this->services[$id])) { return $this->services[$id]; @@ -300,9 +304,6 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE return; } - if (isset($this->privates[$id])) { - @trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); - } $this->loading[$id] = true; diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index b2a1d77a6dd9f..b788de5a7b5c8 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -573,9 +573,6 @@ public function compile() $compiler->compile($this); foreach ($this->definitions as $id => $definition) { - if (!$definition->isPublic()) { - $this->privates[$id] = true; - } if ($this->trackResources && $definition->isLazy() && ($class = $definition->getClass()) && class_exists($class)) { $this->addClassResource(new \ReflectionClass($class)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 30173f7a1827c..8d5eda9ce5fe8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -126,7 +126,7 @@ public function testGetServiceIds() $sc = new ProjectServiceContainer(); $sc->set('foo', $obj = new \stdClass()); - $this->assertEquals(array('service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()'); + $this->assertEquals(array('service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()'); } /** @@ -397,7 +397,8 @@ public function testUnsetInternalPrivateServiceIsDeprecated() public function testChangeInternalPrivateServiceIsDeprecated() { $c = new ProjectServiceContainer(); - $c->set('internal', new \stdClass()); + $c->set('internal', $internal = new \stdClass()); + $this->assertSame($c->get('internal'), $internal); } /** @@ -407,7 +408,8 @@ public function testChangeInternalPrivateServiceIsDeprecated() public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated() { $c = new ProjectServiceContainer(); - $c->has('internal'); + $c->get('internal_dependency'); + $this->assertTrue($c->has('internal')); } /** @@ -417,6 +419,7 @@ public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated() public function testRequestAnInternalSharedPrivateServiceIsDeprecated() { $c = new ProjectServiceContainer(); + $c->get('internal_dependency'); $c->get('internal'); } } @@ -435,6 +438,7 @@ class ProjectServiceContainer extends Container 'circular' => 'getCircularService', 'throw_exception' => 'getThrowExceptionService', 'throws_exception_on_service_configuration' => 'getThrowsExceptionOnServiceConfigurationService', + 'internal_dependency' => 'getInternalDependencyService', ); public function __construct() @@ -451,7 +455,7 @@ public function __construct() protected function getInternalService() { - return $this->__internal; + return $this->services['internal'] = $this->__internal; } protected function getBarService() @@ -485,6 +489,15 @@ protected function getThrowsExceptionOnServiceConfigurationService() throw new \Exception('Something was terribly wrong while trying to configure the service!'); } + + protected function getInternalDependencyService() + { + $this->services['internal_dependency'] = $instance = new \stdClass(); + + $instance->internal = isset($this->services['internal']) ? $this->services['internal'] : $this->getInternalService(); + + return $instance; + } } class LegacyProjectServiceContainer extends Container From 6350dab5bf7a05e72d6ae531c9e89f876de32f7e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 May 2017 13:49:26 +0200 Subject: [PATCH 43/75] don't call getTrustedHeaderName() if possible --- .../HttpKernel/Fragment/InlineFragmentRenderer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php index 09ce50df4d260..437b40bf95953 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php @@ -119,7 +119,11 @@ protected function createSubRequest($uri, Request $request) // Sub-request object will point to localhost as client ip and real client ip // will be included into trusted header for client ip try { - if ($trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP, false)) { + if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { + $currentXForwardedFor = $request->headers->get('X_FORWARDED_FOR', ''); + + $server['HTTP_X_FORWARDED_FOR'] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); + } elseif (method_exists(Request::class, 'getTrustedHeaderName') && $trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP, false)) { $currentXForwardedFor = $request->headers->get($trustedHeaderName, ''); $server['HTTP_'.$trustedHeaderName] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); From a2079d6e2ee54e8da3081b3796594f61a7457b0b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 May 2017 11:14:20 +0200 Subject: [PATCH 44/75] [Yaml] fix multiline block handling --- src/Symfony/Component/Yaml/Parser.php | 6 ++- .../Component/Yaml/Tests/ParserTest.php | 50 ++++++++++++++++++- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index dcedd899bc704..52cd1867efcfd 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -368,7 +368,11 @@ private function doParse($value, $flags) foreach ($this->lines as $line) { try { - $parsedLine = Inline::parse($line, $flags, $this->refs); + if (isset($line[0]) && ('"' === $line[0] || "'" === $line[0])) { + $parsedLine = $line; + } else { + $parsedLine = Inline::parse($line, $flags, $this->refs); + } if (!is_string($parsedLine)) { $parseError = true; diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index f64d7589d8d88..c8f4a7d40e35e 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -1561,8 +1561,18 @@ public function testParseMultiLineString() $this->assertEquals("foo bar\nbaz", $this->parser->parse("foo\nbar\n\nbaz")); } - public function testParseMultiLineMappingValue() + /** + * @dataProvider multiLineDataProvider + */ + public function testParseMultiLineMappingValue($yaml, $expected, $parseError) + { + $this->assertEquals($expected, $this->parser->parse($yaml)); + } + + public function multiLineDataProvider() { + $tests = array(); + $yaml = <<<'EOF' foo: - bar: @@ -1579,7 +1589,43 @@ public function testParseMultiLineMappingValue() ), ); - $this->assertEquals($expected, $this->parser->parse($yaml)); + $tests[] = array($yaml, $expected, false); + + $yaml = <<<'EOF' +bar +"foo" +EOF; + $expected = 'bar "foo"'; + + $tests[] = array($yaml, $expected, false); + + $yaml = <<<'EOF' +bar +"foo +EOF; + $expected = 'bar "foo'; + + $tests[] = array($yaml, $expected, false); + + $yaml = <<<'EOF' +bar + +'foo' +EOF; + $expected = "bar\n'foo'"; + + $tests[] = array($yaml, $expected, false); + + $yaml = <<<'EOF' +bar + +foo' +EOF; + $expected = "bar\nfoo'"; + + $tests[] = array($yaml, $expected, false); + + return $tests; } public function testTaggedInlineMapping() From 6f672211292d47d4b34629b8f4d7768c831e80bd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 May 2017 23:58:11 +0200 Subject: [PATCH 45/75] [Routing] remove an unused routing fixture This was initially removed in #13361 and accidentally added again in #11394. --- .../Component/Routing/Tests/Fixtures/validpattern.xml | 9 --------- .../Component/Routing/Tests/Loader/XmlFileLoaderTest.php | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml b/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml index e8d07350b7a42..dbc72e46ddd4d 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml @@ -11,14 +11,5 @@ context.getMethod() == "GET" - - MyBundle:Blog:show - GET|POST|put|OpTiOnS - hTTps - \w+ - - context.getMethod() == "GET" - - diff --git a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php index e8e24fde58698..d24ec79a79c59 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php @@ -70,7 +70,7 @@ public function testLoadWithImport() $routeCollection = $loader->load('validresource.xml'); $routes = $routeCollection->all(); - $this->assertCount(3, $routes, 'Two routes are loaded'); + $this->assertCount(2, $routes, 'Two routes are loaded'); $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes); foreach ($routes as $route) { From c67dd3805bc383a939d34068bbc4d7e6aa653ed7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 May 2017 10:41:50 +0200 Subject: [PATCH 46/75] [Yaml] Add missing deprecation annotation --- src/Symfony/Component/Yaml/Dumper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index a38bce014279a..e26a65a5076d7 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -41,6 +41,8 @@ public function __construct($indentation = 4) * Sets the indentation. * * @param int $num The amount of spaces to use for indentation of nested nodes + * + * @deprecated since version 3.1, to be removed in 4.0. Pass the indentation to the constructor instead. */ public function setIndentation($num) { From 95fb929c5877c03dc17b4a38e266c2c39249369b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 May 2017 10:44:44 +0200 Subject: [PATCH 47/75] [DI] Add missing deprecation on Extension::getClassesToCompile --- UPGRADE-3.3.md | 2 +- UPGRADE-4.0.md | 2 +- src/Symfony/Component/HttpKernel/CHANGELOG.md | 2 +- .../Component/HttpKernel/DependencyInjection/Extension.php | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index 3734fff5e29a8..c068b378f51b5 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -266,7 +266,7 @@ HttpKernel * Deprecated the `Kernel::getRootDir()` method. Use the new `Kernel::getProjectDir()` method instead. - * The `Extension::addClassesToCompile()` method has been deprecated and will be removed in 4.0. + * The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been deprecated and will be removed in 4.0. * The `Psr6CacheClearer::addPool()` method has been deprecated. Pass an array of pools indexed by name to the constructor instead. diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 0f89d2b3b791f..1191c074aed68 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -376,7 +376,7 @@ HttpKernel * Removed the `Kernel::getRootDir()` method. Use the `Kernel::getProjectDir()` method instead. - * The `Extension::addClassesToCompile()` method has been removed. + * The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been removed. * Possibility to pass non-scalar values as URI attributes to the ESI and SSI renderers has been removed. The inline fragment renderer should be used with diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index b963960fe0a4a..061f61d172e25 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -10,7 +10,7 @@ CHANGELOG * deprecated the special `SYMFONY__` environment variables * added the possibility to change the query string parameter used by `UriSigner` * deprecated `LazyLoadingFragmentHandler::addRendererService()` - * deprecated `Extension::addClassesToCompile()` + * deprecated `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` * deprecated `Psr6CacheClearer::addPool()` 3.2.0 diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php index 99ae0d4b90109..573e1b4e6b669 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php @@ -27,9 +27,15 @@ abstract class Extension extends BaseExtension * Gets the classes to cache. * * @return array An array of classes + * + * @deprecated since version 3.3, to be removed in 4.0. */ public function getClassesToCompile() { + if (PHP_VERSION_ID >= 70000) { + @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + } + return $this->classes; } From c4b6e2014c23258ba8b2ed1fdcf7b3ea5f77e361 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 21 May 2017 10:11:14 +0200 Subject: [PATCH 48/75] [DI] prepare for signature change in 4.0 --- .../DependencyInjection/LazyProxy/PhpDumper/NullDumper.php | 4 +++- .../DependencyInjection/Tests/Fixtures/includes/classes.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php index 30911d3a5e83a..808ed8ec9cbe5 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php @@ -17,6 +17,8 @@ * Null dumper, negates any proxy code generation for any given service definition. * * @author Marco Pivetta + * + * @final since version 3.4 */ class NullDumper implements DumperInterface { @@ -31,7 +33,7 @@ public function isProxyCandidate(Definition $definition) /** * {@inheritdoc} */ - public function getProxyFactoryCode(Definition $definition, $id) + public function getProxyFactoryCode(Definition $definition, $id, $methodName = null) { return ''; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 68fd01cf848b4..717dcdc52e579 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -88,7 +88,7 @@ public function isProxyCandidate(Definition $definition) return false; } - public function getProxyFactoryCode(Definition $definition, $id) + public function getProxyFactoryCode(Definition $definition, $id, $methodName = null) { return ''; } From 1d9b1af4a396b10bd56982a9e9e4d16604f780b2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 May 2017 16:35:51 +0200 Subject: [PATCH 49/75] [DI] Check privates before aliases consistently --- src/Symfony/Component/DependencyInjection/Container.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 119fb432a321b..2f96abca34097 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -256,15 +256,15 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE // this method can be called thousands of times during a request, avoid // calling strtolower() unless necessary. for ($i = 2;;) { + if (isset($this->privates[$id])) { + @trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); + } if ('service_container' === $id) { return $this; } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } - if (isset($this->privates[$id])) { - @trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); - } // Re-use shared service instance if it exists. if (isset($this->services[$id])) { From 4aeb6d8749aa631c17696f70be34d42bf6d682e7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 May 2017 17:30:25 +0200 Subject: [PATCH 50/75] [ProxyManager] Add FC layer --- UPGRADE-3.3.md | 7 +++++++ UPGRADE-4.0.md | 5 +++++ src/Symfony/Bridge/ProxyManager/CHANGELOG.md | 5 +++++ .../ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php | 4 +++- src/Symfony/Component/DependencyInjection/CHANGELOG.md | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index c068b378f51b5..3fd31e579910e 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -82,6 +82,8 @@ DependencyInjection * Autowiring services based on the types they implement is deprecated and won't be supported in version 4.0. Rename (or alias) your services to their FQCN id to make them autowirable. + * [BC BREAK] The `NullDumper` class has been made final + * [BC BREAK] `_defaults` and `_instanceof` are now reserved service names in Yaml configurations. Please rename any services with that names. * [BC BREAK] non-numeric keys in methods and constructors arguments have never been supported and are now forbidden. Please remove them if you happen to have one. @@ -301,6 +303,11 @@ Process * Extending `Process::run()`, `Process::mustRun()` and `Process::restart()` is deprecated and won't be supported in 4.0. +ProxyManager +------------ + + * [BC BREAK] The `ProxyDumper` class has been made final + Security -------- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 1191c074aed68..566231d6ffec7 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -424,6 +424,11 @@ Process * Extending `Process::run()`, `Process::mustRun()` and `Process::restart()` is not supported anymore. +ProxyManager +------------ + + * The `ProxyDumper` class has been made final + Security -------- diff --git a/src/Symfony/Bridge/ProxyManager/CHANGELOG.md b/src/Symfony/Bridge/ProxyManager/CHANGELOG.md index 1f8f60c48bfed..56c8b20e28272 100644 --- a/src/Symfony/Bridge/ProxyManager/CHANGELOG.md +++ b/src/Symfony/Bridge/ProxyManager/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +3.3.0 +----- + + * [BC BREAK] The `ProxyDumper` class is now final + 2.3.0 ----- diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 447549b970442..b91bfeb922cf8 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -22,6 +22,8 @@ * Generates dumped PHP code of proxies via reflection. * * @author Marco Pivetta + * + * @final since version 3.3 */ class ProxyDumper implements DumperInterface { @@ -63,7 +65,7 @@ public function isProxyCandidate(Definition $definition) /** * {@inheritdoc} */ - public function getProxyFactoryCode(Definition $definition, $id) + public function getProxyFactoryCode(Definition $definition, $id, $methodName = null) { $instantiation = 'return'; diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md index a85de7dff882c..b591c5958dae7 100644 --- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -28,6 +28,7 @@ CHANGELOG will not be supported anymore in 4.0 * deprecated the `DefinitionDecorator` class in favor of `ChildDefinition` * allow config files to be loaded using a glob pattern + * [BC BREAK] the `NullDumper` class is now final 3.2.0 ----- From 38a768e3cc53b86ebe8a7774c54fc31c19e32ffa Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 May 2017 18:45:53 +0200 Subject: [PATCH 51/75] [Cache] Fix phpunit.xml.dist --- src/Symfony/Component/Cache/phpunit.xml.dist | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/phpunit.xml.dist b/src/Symfony/Component/Cache/phpunit.xml.dist index 19128dcc132f8..1f409af31cf01 100644 --- a/src/Symfony/Component/Cache/phpunit.xml.dist +++ b/src/Symfony/Component/Cache/phpunit.xml.dist @@ -33,8 +33,12 @@ - Cache\IntegrationTests - Doctrine\Common\Cache + + + Cache\IntegrationTests + Doctrine\Common\Cache + + From c224ad7770552b4b98976aaac9e276b14d9e9c1f Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Thu, 25 May 2017 00:25:35 +0700 Subject: [PATCH 52/75] [CACHE] fix README --- src/Symfony/Component/Cache/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Symfony/Component/Cache/README.md b/src/Symfony/Component/Cache/README.md index 604fb1d5b410c..c4ab7520f451e 100644 --- a/src/Symfony/Component/Cache/README.md +++ b/src/Symfony/Component/Cache/README.md @@ -7,3 +7,12 @@ low overhead so that caching is fastest. It ships with a few caching adapters for the most widespread and suited to caching backends. It also provides a `doctrine/cache` proxy adapter to cover more advanced caching needs and a proxy adapter for greater interoperability between PSR-6 implementations. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/cache.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) From ae52fe6dabf45767f54ce0a71abd9fcb92963dad Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 May 2017 11:43:45 +0200 Subject: [PATCH 53/75] [Yaml] parse PHP constants in mapping keys --- src/Symfony/Component/Yaml/Parser.php | 11 +++- .../Component/Yaml/Tests/ParserTest.php | 50 +++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 52cd1867efcfd..42f61af9de0a4 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -208,7 +208,7 @@ private function doParse($value, $flags) $this->refs[$isRef] = end($data); } } elseif ( - self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|(?:![^\s]++\s++)?[^ \'"\[\{!].*?) *\:(\s++(?P.+))?$#u', rtrim($this->currentLine), $values) + self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?(?:![^\s]++\s++)?[^ \'"\[\{!].*?) *\:(\s++(?P.+))?$#u', rtrim($this->currentLine), $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'"))) ) { if ($context && 'sequence' == $context) { @@ -221,7 +221,14 @@ private function doParse($value, $flags) try { Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); $i = 0; - $key = Inline::parseScalar($values['key'], 0, null, $i, !(Yaml::PARSE_KEYS_AS_STRINGS & $flags)); + $evaluateKey = !(Yaml::PARSE_KEYS_AS_STRINGS & $flags); + + // constants in key will be evaluated anyway + if (isset($values['key'][0]) && '!' === $values['key'][0] && Yaml::PARSE_CONSTANT & $flags) { + $evaluateKey = true; + } + + $key = Inline::parseScalar($values['key'], 0, null, $i, $evaluateKey); } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index c8f4a7d40e35e..a0bef9d528c81 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -1819,9 +1819,59 @@ public function testParserCleansUpReferencesBetweenRuns() YAML; $this->parser->parse($yaml); } + + public function testPhpConstantTagMappingKey() + { + $yaml = << array( + 'foo' => array( + 'from' => array( + 'bar', + ), + 'to' => 'baz', + ), + ), + ); + + $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT)); + } + + public function testPhpConstantTagMappingKeyWithKeysCastToStrings() + { + $yaml = << array( + 'foo' => array( + 'from' => array( + 'bar', + ), + 'to' => 'baz', + ), + ), + ); + + $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT | Yaml::PARSE_KEYS_AS_STRINGS)); + } } class B { public $b = 'foo'; + + const FOO = 'foo'; + const BAR = 'bar'; + const BAZ = 'baz'; } From 3e6643bd9074e9ed93e94a66e8aa0914aa58a973 Mon Sep 17 00:00:00 2001 From: adev Date: Wed, 24 May 2017 23:07:05 +0200 Subject: [PATCH 54/75] [FrameworkBundle][Console] Fix the override of a command registered by the kernel Fix #18558 --- .../FrameworkBundle/Console/Application.php | 11 +++++++++++ .../Tests/Console/ApplicationTest.php | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 6e6aca6043c67..3ccb97fe39231 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -13,6 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\Console\Application as BaseApplication; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -120,6 +121,16 @@ public function all($namespace = null) return parent::all($namespace); } + /** + * {@inheritdoc} + */ + public function add(Command $command) + { + $this->registerCommands(); + + return parent::add($command); + } + protected function registerCommands() { if ($this->commandsRegistered) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php index fc60fd3bdd71c..25511142c9b54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -115,6 +115,21 @@ public function testBundleCommandsHaveRightContainer() $tester->run(array('command' => 'foo')); } + public function testBundleCommandCanOverriddeAPreExistingCommandWithTheSameName() + { + $command = new Command('example'); + + $bundle = $this->createBundleMock(array($command)); + + $kernel = $this->getKernel(array($bundle)); + + $application = new Application($kernel); + $newCommand = new Command('example'); + $application->add($newCommand); + + $this->assertSame($newCommand, $application->get('example')); + } + private function getKernel(array $bundles, $useDispatcher = false) { $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); From a8414962389538142e65f0cb682772b102576208 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 25 May 2017 11:59:16 +0200 Subject: [PATCH 55/75] [Form] Remove DateTimeToStringTransformer $parseUsingPipe option --- .../DateTimeToStringTransformer.php | 80 +------------------ .../DateTimeToStringTransformerTest.php | 16 +--- 2 files changed, 4 insertions(+), 92 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php index 56dee3502787b..daeee5cce7799 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php @@ -40,15 +40,6 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer */ private $parseFormat; - /** - * Whether to parse by appending a pipe "|" to the parse format. - * - * This only works as of PHP 5.3.7. - * - * @var bool - */ - private $parseUsingPipe; - /** * Transforms a \DateTime instance to a string. * @@ -57,18 +48,15 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer * @param string $inputTimezone The name of the input timezone * @param string $outputTimezone The name of the output timezone * @param string $format The date format - * @param bool $parseUsingPipe Whether to parse by appending a pipe "|" to the parse format * * @throws UnexpectedTypeException if a timezone is not a string */ - public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = true) + public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s') { parent::__construct($inputTimezone, $outputTimezone); $this->generateFormat = $this->parseFormat = $format; - $this->parseUsingPipe = $parseUsingPipe || null === $parseUsingPipe; - // See http://php.net/manual/en/datetime.createfromformat.php // The character "|" in the format makes sure that the parts of a date // that are *not* specified in the format are reset to the corresponding @@ -77,7 +65,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $form // where the time corresponds to the current server time. // With "|" and "Y-m-d", "2010-02-03" becomes "2010-02-03 00:00:00", // which is at least deterministic and thus used here. - if ($this->parseUsingPipe && false === strpos($this->parseFormat, '|')) { + if (false === strpos($this->parseFormat, '|')) { $this->parseFormat .= '|'; } } @@ -147,70 +135,6 @@ public function reverseTransform($value) } try { - // On PHP versions < 5.3.7 we need to emulate the pipe operator - // and reset parts not given in the format to their equivalent - // of the UNIX base timestamp. - if (!$this->parseUsingPipe) { - list($year, $month, $day, $hour, $minute, $second) = explode('-', $dateTime->format('Y-m-d-H-i-s')); - - // Check which of the date parts are present in the pattern - preg_match( - '/('. - '(?P[djDl])|'. - '(?P[FMmn])|'. - '(?P[Yy])|'. - '(?P[ghGH])|'. - '(?Pi)|'. - '(?Ps)|'. - '(?Pz)|'. - '(?PU)|'. - '[^djDlFMmnYyghGHiszU]'. - ')*/', - $this->parseFormat, - $matches - ); - - // preg_match() does not guarantee to set all indices, so - // set them unless given - $matches = array_merge(array( - 'day' => false, - 'month' => false, - 'year' => false, - 'hour' => false, - 'minute' => false, - 'second' => false, - 'dayofyear' => false, - 'timestamp' => false, - ), $matches); - - // Reset all parts that don't exist in the format to the - // corresponding part of the UNIX base timestamp - if (!$matches['timestamp']) { - if (!$matches['dayofyear']) { - if (!$matches['day']) { - $day = 1; - } - if (!$matches['month']) { - $month = 1; - } - } - if (!$matches['year']) { - $year = 1970; - } - if (!$matches['hour']) { - $hour = 0; - } - if (!$matches['minute']) { - $minute = 0; - } - if (!$matches['second']) { - $second = 0; - } - $dateTime->setDate($year, $month, $day); - $dateTime->setTime($hour, $minute, $second); - } - } - if ($this->inputTimezone !== $this->outputTimezone) { $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php index 883634985a2f8..e2389ebf003a8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php @@ -120,21 +120,9 @@ public function testTransformExpectsDateTime() /** * @dataProvider dataProvider */ - public function testReverseTransformUsingPipe($format, $input, $output) + public function testReverseTransform($format, $input, $output) { - $reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true); - - $output = new \DateTime($output); - - $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input)); - } - - /** - * @dataProvider dataProvider - */ - public function testReverseTransformWithoutUsingPipe($format, $input, $output) - { - $reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, false); + $reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format); $output = new \DateTime($output); From 40f60ec60daa54fc83f4210f4715a9ccafad0a96 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 24 May 2017 21:00:11 -0400 Subject: [PATCH 56/75] Fixing missing abstract attribute in XmlDumper Caused mis-reporting of abstract key (always no) in debug:container --- .../DependencyInjection/Dumper/XmlDumper.php | 4 ++++ .../Tests/Dumper/XmlDumperTest.php | 8 ++++++++ .../Tests/Fixtures/containers/container_abstract.php | 12 ++++++++++++ .../Tests/Fixtures/xml/services_abstract.xml | 6 ++++++ 4 files changed, 30 insertions(+) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_abstract.php create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_abstract.xml diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 3306c4b1a6439..c793e9aed0f3d 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -191,6 +191,10 @@ private function addService($definition, $id, \DOMElement $parent) $service->appendChild($factory); } + if ($definition->isAbstract()) { + $service->setAttribute('abstract', 'true'); + } + if ($callable = $definition->getConfigurator()) { $configurator = $this->document->createElement('configurator'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index 72ae5897204f1..687ba1efcb55f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -184,4 +184,12 @@ public function testDumpInlinedServices() $this->assertEquals(file_get_contents(self::$fixturesPath.'/xml/services21.xml'), $dumper->dump()); } + + public function testDumpAbstractServices() + { + $container = include self::$fixturesPath.'/containers/container_abstract.php'; + $dumper = new XmlDumper($container); + + $this->assertEquals(file_get_contents(self::$fixturesPath.'/xml/services_abstract.xml'), $dumper->dump()); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_abstract.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_abstract.php new file mode 100644 index 0000000000000..9622a273d3806 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_abstract.php @@ -0,0 +1,12 @@ +register('foo', 'Foo') + ->setAbstract(true) +; + +return $container; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_abstract.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_abstract.xml new file mode 100644 index 0000000000000..97e5ce419befc --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_abstract.xml @@ -0,0 +1,6 @@ + + + + + + From 56892819e35ab2417ac989f55fc6faf93c61996e Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Thu, 25 May 2017 12:05:01 +0200 Subject: [PATCH 57/75] [DI] Avoid private call to Container::has() --- .../DependencyInjection/Dumper/PhpDumper.php | 8 ++++++++ .../Tests/Dumper/PhpDumperTest.php | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 28cad05b5952d..4431418d85848 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1191,9 +1191,17 @@ private function wrapServiceConditionals($value, $code) $conditions = array(); foreach ($services as $service) { + if ($this->container->hasDefinition($service) && !$this->container->getDefinition($service)->isPublic()) { + continue; + } + $conditions[] = sprintf("\$this->has('%s')", $service); } + if (!$conditions) { + return $code; + } + // re-indent the wrapped code $code = implode("\n", array_map(function ($line) { return $line ? ' '.$line : $line; }, explode("\n", $code))); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index c63d5ec18315c..2ad701aa6d327 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; @@ -406,4 +407,21 @@ public function testDumpContainerBuilderWithFrozenConstructorIncludingPrivateSer $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_private_frozen.php', $dumper->dump()); } + + public function testPrivateWithIgnoreOnInvalidReference() + { + require_once self::$fixturesPath.'/includes/classes.php'; + + $container = new ContainerBuilder(); + $container->register('not_invalid', 'BazClass') + ->setPublic(false); + $container->register('bar', 'BarClass') + ->addMethodCall('setBaz', array(new Reference('not_invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference'))); + + $container = new \Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference(); + $this->assertInstanceOf('BazClass', $container->get('bar')->getBaz()); + } } From 9ba12b0d2a79e89f9bc0b9836a35ce2165aca810 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 25 May 2017 09:51:51 +0200 Subject: [PATCH 58/75] [HttpFoundation] Add Request::HEADER_X_FORWARDED_AWS_ELB const --- src/Symfony/Component/HttpFoundation/Request.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 4962256376d71..cf812a960f2d4 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -30,12 +30,13 @@ */ class Request { - const HEADER_FORWARDED = 0b00001; - const HEADER_X_FORWARDED_ALL = 0b11110; - const HEADER_X_FORWARDED_FOR = 2; - const HEADER_X_FORWARDED_HOST = 4; - const HEADER_X_FORWARDED_PROTO = 8; - const HEADER_X_FORWARDED_PORT = 16; + const HEADER_FORWARDED = 0b00001; // When using RFC 7239 + const HEADER_X_FORWARDED_FOR = 0b00010; + const HEADER_X_FORWARDED_HOST = 0b00100; + const HEADER_X_FORWARDED_PROTO = 0b01000; + const HEADER_X_FORWARDED_PORT = 0b10000; + const HEADER_X_FORWARDED_ALL = 0b11110; // All "X-Forwarded-*" headers + const HEADER_X_FORWARDED_AWS_ELB = 0b11010; // AWS ELB doesn't send X-Forwarded-Host /** @deprecated since version 3.3, to be removed in 4.0 */ const HEADER_CLIENT_IP = self::HEADER_X_FORWARDED_FOR; From 25381a2809d43348ed2ad0be0d45d433238c096e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 25 May 2017 11:59:42 +0200 Subject: [PATCH 59/75] [Filesystem] improve error handling in lock() --- .../Component/Filesystem/LockHandler.php | 9 +++-- .../Filesystem/Tests/LockHandlerTest.php | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Filesystem/LockHandler.php b/src/Symfony/Component/Filesystem/LockHandler.php index 67e6f8f522c1c..3496faae21336 100644 --- a/src/Symfony/Component/Filesystem/LockHandler.php +++ b/src/Symfony/Component/Filesystem/LockHandler.php @@ -68,8 +68,12 @@ public function lock($blocking = false) return true; } + $error = null; + // Silence error reporting - set_error_handler(function () {}); + set_error_handler(function ($errno, $msg) use (&$error) { + $error = $msg; + }); if (!$this->handle = fopen($this->file, 'r')) { if ($this->handle = fopen($this->file, 'x')) { @@ -82,8 +86,7 @@ public function lock($blocking = false) restore_error_handler(); if (!$this->handle) { - $error = error_get_last(); - throw new IOException($error['message'], 0, null, $this->file); + throw new IOException($error, 0, null, $this->file); } // On Windows, even if PHP doc says the contrary, LOCK_NB works, see diff --git a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php index 1fc2ebc0c1e6e..0791cebc694b8 100644 --- a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php +++ b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php @@ -12,6 +12,8 @@ namespace Symfony\Component\Filesystem\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\Filesystem\Exception\IOException; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\LockHandler; class LockHandlerTest extends TestCase @@ -40,6 +42,44 @@ public function testConstructWhenRepositoryIsNotWriteable() new LockHandler('lock', '/'); } + public function testErrorHandlingInLockIfLockPathBecomesUnwritable() + { + // skip test on Windows; PHP can't easily set file as unreadable on Windows + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test cannot run on Windows.'); + } + + $lockPath = sys_get_temp_dir().'/'.uniqid(); + $e = null; + $wrongMessage = null; + + try { + mkdir($lockPath); + + $lockHandler = new LockHandler('lock', $lockPath); + + chmod($lockPath, 0444); + + $lockHandler->lock(); + } catch (IOException $e) { + if (false === strpos($e->getMessage(), 'Permission denied')) { + $wrongMessage = $e->getMessage(); + } else { + $this->addToAssertionCount(1); + } + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + + if (is_dir($lockPath)) { + $fs = new Filesystem(); + $fs->remove($lockPath); + } + + $this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', get_class($e))); + $this->assertNull($wrongMessage, sprintf('Expected exception message to contain "Permission denied", got "%s" instead.', $wrongMessage)); + } + public function testConstructSanitizeName() { $lock = new LockHandler(''); From 68c1917af9135f0b4ff170befa13f45e15ca6577 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 25 May 2017 10:01:20 +0200 Subject: [PATCH 60/75] [FrameworkBundle][Validator] Move the PSR-11 factory to the component --- UPGRADE-3.3.md | 11 +-- UPGRADE-4.0.md | 12 +-- .../Bundle/FrameworkBundle/CHANGELOG.md | 6 +- .../Resources/config/validator.xml | 2 +- .../ConstraintValidatorFactoryTest.php | 13 ++- .../Validator/ConstraintValidatorFactory.php | 34 +++---- .../Bundle/FrameworkBundle/composer.json | 4 +- src/Symfony/Component/Validator/CHANGELOG.md | 1 + .../ContainerConstraintValidatorFactory.php | 62 +++++++++++++ ...ontainerConstraintValidatorFactoryTest.php | 88 +++++++++++++++++++ 10 files changed, 181 insertions(+), 52 deletions(-) create mode 100644 src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php create mode 100644 src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index 3fd31e579910e..05f44e549e11b 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -203,11 +203,6 @@ FrameworkBundle deprecated and will be removed in 4.0. Use the `Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass` class instead. - * The `ConstraintValidatorFactory::$validators` and `$container` properties - have been deprecated and will be removed in 4.0. - - * Extending `ConstraintValidatorFactory` is deprecated and won't be supported in 4.0. - * Class parameters related to routing have been deprecated and will be removed in 4.0. * router.options.generator_class * router.options.generator_base_class @@ -246,9 +241,9 @@ FrameworkBundle class has been deprecated and will be removed in 4.0. Use the `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` class instead. - * Passing an array of validators or validator aliases as the second argument of - `ConstraintValidatorFactory::__construct()` is deprecated since 3.3 and will - be removed in 4.0. Use the service locator instead. + * The `Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory` + class has been deprecated and will be removed in 4.0. + Use `Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead. HttpFoundation -------------- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 566231d6ffec7..6c10190c7c502 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -294,15 +294,6 @@ FrameworkBundle removed. Use the `Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass` class instead. - * The `ConstraintValidatorFactory::$validators` and `$container` properties - have been removed. - - * Extending `ConstraintValidatorFactory` is not supported anymore. - - * Passing an array of validators or validator aliases as the second argument of - `ConstraintValidatorFactory::__construct()` has been removed. - Use the service locator instead. - * Class parameters related to routing have been removed * router.options.generator_class * router.options.generator_base_class @@ -335,6 +326,9 @@ FrameworkBundle * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass` class has been removed. Use the `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` class instead. + + * The `Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory` class has been removed. + Use `Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead. HttpFoundation -------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index b7473b58129bf..d25f4547d3123 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -31,7 +31,6 @@ CHANGELOG * Deprecated `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass`. Use `Symfony\Component\Console\DependencyInjection\ConfigCachePass` instead. * Deprecated `PropertyInfoPass`, use `Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass` instead - * Deprecated extending `ConstraintValidatorFactory` * Deprecated `ControllerArgumentValueResolverPass`. Use `Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass` instead * Deprecated `RoutingResolverPass`, use `Symfony\Component\Routing\DependencyInjection\RoutingResolverPass` instead @@ -47,9 +46,10 @@ CHANGELOG `Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass` instead * Deprecated `AddConstraintValidatorsPass`, use `Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` instead - * Deprecated `ValidateWorkflowsPass`, use + * Deprecated `ValidateWorkflowsPass`, use `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` instead - * Deprecated `ConstraintValidatorFactory::__construct()` second argument. + * Deprecated `ConstraintValidatorFactory`, use + `Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead. 3.2.0 ----- diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index f895eb4cc0bdf..5f505e859c82b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -59,7 +59,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php index 38a1190aded74..f619584023a77 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php @@ -19,6 +19,9 @@ use Symfony\Component\Validator\Constraints\Blank as BlankConstraint; use Symfony\Component\Validator\ConstraintValidator; +/** + * @group legacy + */ class ConstraintValidatorFactoryTest extends TestCase { public function testGetInstanceCreatesValidator() @@ -27,7 +30,7 @@ public function testGetInstanceCreatesValidator() $constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock(); $constraint - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('validatedBy') ->will($this->returnValue($class)); @@ -63,7 +66,7 @@ public function testGetInstanceReturnsService() $constraint = $this->getMockBuilder(Constraint::class)->getMock(); $constraint - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('validatedBy') ->will($this->returnValue($service)); @@ -71,10 +74,6 @@ public function testGetInstanceReturnsService() $this->assertSame($validator, $factory->getInstance($constraint)); } - /** - * @group legacy - * @expectedDeprecation Passing an array of validators or validator aliases as the second argument of "Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory::__construct" is deprecated since 3.3 and will be removed in 4.0. Use the service locator instead. - */ public function testGetInstanceReturnsServiceWithAlias() { $service = 'validator_constraint_service'; @@ -106,7 +105,7 @@ public function testGetInstanceInvalidValidatorClass() { $constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock(); $constraint - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('validatedBy') ->will($this->returnValue('Fully\\Qualified\\ConstraintValidator\\Class\\Name')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php index 49cd5fe1138cb..1a9020ad687a3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php +++ b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php @@ -13,10 +13,12 @@ use Psr\Container\ContainerInterface; use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\Exception\ValidatorException; +use Symfony\Component\Validator\ContainerConstraintValidatorFactory; use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\ValidatorException; + +@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use %s instead.', ConstraintValidatorFactory::class, ContainerConstraintValidatorFactory::class), E_USER_DEPRECATED); /** * Uses a service container to create constraint validators. @@ -38,24 +40,19 @@ * * @author Kris Wallsmith * - * @final since version 3.3 + * @deprecated since version 3.3 */ -class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface +class ConstraintValidatorFactory extends ContainerConstraintValidatorFactory { protected $container; protected $validators; - public function __construct(ContainerInterface $container, array $validators = null) + public function __construct(ContainerInterface $container, array $validators = array()) { - $this->container = $container; - - if (null !== $validators) { - @trigger_error(sprintf('Passing an array of validators or validator aliases as the second argument of "%s" is deprecated since 3.3 and will be removed in 4.0. Use the service locator instead.', __METHOD__), E_USER_DEPRECATED); - } else { - $validators = array(); - } + parent::__construct($container); $this->validators = $validators; + $this->container = $container; } /** @@ -73,17 +70,10 @@ public function getInstance(Constraint $constraint) $name = $constraint->validatedBy(); if (!isset($this->validators[$name])) { - if ($this->container->has($name)) { - $this->validators[$name] = $this->container->get($name); - } else { - if (!class_exists($name)) { - throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or it is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, get_class($constraint))); - } + return parent::getInstance($constraint); + } - $this->validators[$name] = new $name(); - } - } elseif (is_string($this->validators[$name])) { - // To be removed in 4.0 + if (is_string($this->validators[$name])) { $this->validators[$name] = $this->container->get($this->validators[$name]); } diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 75725c32b90b1..70b922c1fcc1f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -49,7 +49,7 @@ "symfony/serializer": "~3.3", "symfony/translation": "~3.2", "symfony/templating": "~2.8|~3.0", - "symfony/validator": "~3.3", + "symfony/validator": "~3.3-rc2", "symfony/workflow": "~3.3", "symfony/yaml": "~3.2", "symfony/property-info": "~3.3", @@ -69,7 +69,7 @@ "symfony/property-info": "<3.3", "symfony/serializer": "<3.3", "symfony/translation": "<3.2", - "symfony/validator": "<3.3", + "symfony/validator": "<3.3-rc2", "symfony/workflow": "<3.3" }, "suggest": { diff --git a/src/Symfony/Component/Validator/CHANGELOG.md b/src/Symfony/Component/Validator/CHANGELOG.md index 7099496cfa1d2..14f7b905a8c32 100644 --- a/src/Symfony/Component/Validator/CHANGELOG.md +++ b/src/Symfony/Component/Validator/CHANGELOG.md @@ -6,6 +6,7 @@ CHANGELOG * added `AddValidatorInitializersPass` * added `AddConstraintValidatorsPass` + * added `ContainerConstraintValidatorFactory` 3.2.0 ----- diff --git a/src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php b/src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php new file mode 100644 index 0000000000000..a40be361f1c71 --- /dev/null +++ b/src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Psr\Container\ContainerInterface; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Uses a service container to create constraint validators. + * + * @author Kris Wallsmith + */ +class ContainerConstraintValidatorFactory implements ConstraintValidatorFactoryInterface +{ + private $container; + private $validators; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + $this->validators = array(); + } + + /** + * {@inheritdoc} + * + * @throws ValidatorException When the validator class does not exist + * @throws UnexpectedTypeException When the validator is not an instance of ConstraintValidatorInterface + */ + public function getInstance(Constraint $constraint) + { + $name = $constraint->validatedBy(); + + if (!isset($this->validators[$name])) { + if ($this->container->has($name)) { + $this->validators[$name] = $this->container->get($name); + } else { + if (!class_exists($name)) { + throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or it is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, get_class($constraint))); + } + + $this->validators[$name] = new $name(); + } + } + + if (!$this->validators[$name] instanceof ConstraintValidatorInterface) { + throw new UnexpectedTypeException($this->validators[$name], ConstraintValidatorInterface::class); + } + + return $this->validators[$name]; + } +} diff --git a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php new file mode 100644 index 0000000000000..92091484e2905 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Blank as BlankConstraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\ContainerConstraintValidatorFactory; + +class ContainerConstraintValidatorFactoryTest extends TestCase +{ + public function testGetInstanceCreatesValidator() + { + $class = get_class($this->getMockForAbstractClass(ConstraintValidator::class)); + + $constraint = $this->getMockBuilder(Constraint::class)->getMock(); + $constraint + ->expects($this->once()) + ->method('validatedBy') + ->will($this->returnValue($class)); + + $factory = new ContainerConstraintValidatorFactory(new Container()); + $this->assertInstanceOf($class, $factory->getInstance($constraint)); + } + + public function testGetInstanceReturnsExistingValidator() + { + $factory = new ContainerConstraintValidatorFactory(new Container()); + $v1 = $factory->getInstance(new BlankConstraint()); + $v2 = $factory->getInstance(new BlankConstraint()); + $this->assertSame($v1, $v2); + } + + public function testGetInstanceReturnsService() + { + $service = 'validator_constraint_service'; + $validator = $this->getMockForAbstractClass(ConstraintValidator::class); + + // mock ContainerBuilder b/c it implements TaggedContainerInterface + $container = $this->getMockBuilder(ContainerBuilder::class)->setMethods(array('get', 'has'))->getMock(); + $container + ->expects($this->once()) + ->method('get') + ->with($service) + ->willReturn($validator); + $container + ->expects($this->once()) + ->method('has') + ->with($service) + ->willReturn(true); + + $constraint = $this->getMockBuilder(Constraint::class)->getMock(); + $constraint + ->expects($this->once()) + ->method('validatedBy') + ->will($this->returnValue($service)); + + $factory = new ContainerConstraintValidatorFactory($container); + $this->assertSame($validator, $factory->getInstance($constraint)); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ValidatorException + */ + public function testGetInstanceInvalidValidatorClass() + { + $constraint = $this->getMockBuilder(Constraint::class)->getMock(); + $constraint + ->expects($this->once()) + ->method('validatedBy') + ->will($this->returnValue('Fully\\Qualified\\ConstraintValidator\\Class\\Name')); + + $factory = new ContainerConstraintValidatorFactory(new Container()); + $factory->getInstance($constraint); + } +} From c7ed08e2c0aaf4b2db3aa3bc0e733aac2e5dc177 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Fri, 26 May 2017 13:43:16 +0200 Subject: [PATCH 61/75] Only override getProjectDir if it exists in the kernel --- .../Command/CacheClearCommand.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 02aad425c2353..fc970c5e86724 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -199,15 +199,27 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr */ protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir) { + $projectDir = ''; $cacheDir = var_export($warmupDir, true); $rootDir = var_export(realpath($parent->getRootDir()), true); - $projectDir = var_export(realpath($parent->getProjectDir()), true); $logDir = var_export(realpath($parent->getLogDir()), true); // the temp kernel class name must have the same length than the real one // to avoid the many problems in serialized resources files $class = substr($parentClass, 0, -1).'_'; // the temp container class must be changed too $containerClass = var_export(substr(get_class($parent->getContainer()), 0, -1).'_', true); + + if (method_exists($parent, 'getProjectDir')) { + $projectDir = var_export(realpath($parent->getProjectDir()), true); + $projectDir = << Date: Fri, 26 May 2017 07:03:51 -0700 Subject: [PATCH 62/75] fixed CS --- .../Bundle/FrameworkBundle/Command/CacheClearCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index fc970c5e86724..e13d5b33c7d8e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -218,7 +218,7 @@ public function getProjectDir() } EOF; - }; + } $code = << Date: Sat, 27 May 2017 11:47:24 +0200 Subject: [PATCH 63/75] [Cache] Dont use pipelining with RedisCluster --- src/Symfony/Component/Cache/Adapter/RedisAdapter.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php index 377212df75f0d..f84ffa5e48a2a 100644 --- a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php @@ -303,6 +303,14 @@ private function pipeline(\Closure $generator) foreach ($results as $k => list($h, $c)) { $results[$k] = $connections[$h][$c]; } + } elseif ($this->redis instanceof \RedisCluster) { + // phpredis doesn't support pipelining with RedisCluster + // see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining + $result = array(); + foreach ($generator() as $command => $args) { + $ids[] = $args[0]; + $result[] = call_user_func_array(array($this->redis, $command), $args); + } } else { $this->redis->multi(\Redis::PIPELINE); foreach ($generator() as $command => $args) { From 7ba3afd85959f499874a90cac1c255083df75f84 Mon Sep 17 00:00:00 2001 From: Gawain Lynch Date: Sat, 27 May 2017 12:34:25 +0200 Subject: [PATCH 64/75] Adjust PHPUnit class_alias check to also check for namespaced class --- src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php | 2 +- src/Symfony/Bridge/PhpUnit/TextUI/Command.php | 2 +- src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php index f85dbb367ca9c..6d467b35647ec 100644 --- a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php +++ b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; -if (class_exists('PHPUnit_Framework_BaseTestListener')) { +if (class_exists('PHPUnit_Framework_BaseTestListener') && !class_exists('PHPUnit\Framework\BaseTestListener')) { class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\SymfonyTestsListener'); return; diff --git a/src/Symfony/Bridge/PhpUnit/TextUI/Command.php b/src/Symfony/Bridge/PhpUnit/TextUI/Command.php index 77b617fdcc269..90936c847b022 100644 --- a/src/Symfony/Bridge/PhpUnit/TextUI/Command.php +++ b/src/Symfony/Bridge/PhpUnit/TextUI/Command.php @@ -13,7 +13,7 @@ use PHPUnit\TextUI\Command as BaseCommand; -if (class_exists('PHPUnit_TextUI_Command')) { +if (class_exists('PHPUnit_TextUI_Command') && !class_exists('PHPUnit\TextUI\Command')) { class_alias('Symfony\Bridge\PhpUnit\Legacy\Command', 'Symfony\Bridge\PhpUnit\TextUI\Command'); return; diff --git a/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php b/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php index 2d18b4f9afa2b..7351009e8880d 100644 --- a/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php +++ b/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php @@ -14,7 +14,7 @@ use PHPUnit\TextUI\TestRunner as BaseRunner; use Symfony\Bridge\PhpUnit\SymfonyTestsListener; -if (class_exists('PHPUnit_TextUI_Command')) { +if (class_exists('PHPUnit_TextUI_Command') && !class_exists('PHPUnit\TextUI\Command')) { class_alias('Symfony\Bridge\PhpUnit\Legacy\TestRunner', 'Symfony\Bridge\PhpUnit\TextUI\TestRunner'); return; From 2861bd7b01030f6db1fce754854de98164b3527d Mon Sep 17 00:00:00 2001 From: borNfreee Date: Mon, 15 May 2017 23:51:36 +0300 Subject: [PATCH 65/75] [Console] Fixed different behaviour of key and value user inputs in multiple choice question --- .../Console/Question/ChoiceQuestion.php | 2 +- .../Tests/Helper/QuestionHelperTest.php | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index e5b6ff4ad7217..71eea72ef64a0 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -135,7 +135,7 @@ private function getDefaultValidator() if ($multiselect) { // Check for a separated comma values - if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) { + if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) { throw new \InvalidArgumentException(sprintf($errorMessage, $selected)); } $selectedChoices = explode(',', $selectedChoices); diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 49ba0ee06c79a..f42a5255d5587 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -273,6 +273,37 @@ public function simpleAnswerProvider() ); } + /** + * @dataProvider specialCharacterInMultipleChoice + */ + public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer, $expectedValue) + { + $possibleChoices = array( + '.', + 'src', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new ChoiceQuestion('Please select the directory', $possibleChoices); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + + $this->assertSame($expectedValue, $answer); + } + + public function specialCharacterInMultipleChoice() + { + return array( + array('.', array('.')), + array('., src', array('.', 'src')), + ); + } + /** * @dataProvider mixedKeysChoiceListAnswerProvider */ From bab4b9c23c1403b213ed7065c6752aad06c64896 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 21 May 2017 20:56:28 +0200 Subject: [PATCH 66/75] Make the simple exception pages match the new style --- .../Component/Debug/ExceptionHandler.php | 151 ++++++++++-------- .../Debug/Tests/ExceptionHandlerTest.php | 10 +- 2 files changed, 87 insertions(+), 74 deletions(-) diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index f2ae4b102e13d..1fe60d9f31e69 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -220,28 +220,30 @@ public function getContent(FlattenException $exception) $class = $this->formatClass($e['class']); $message = nl2br($this->escapeHtml($e['message'])); $content .= sprintf(<<<'EOF' -

- %d/%d - %s%s: - %s -

-
-
    - +
    + + + EOF - , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message); + , $ind, $total, $class, $message); foreach ($e['trace'] as $trace) { - $content .= '
  1. '; + $content .= '
  2. \n"; } - $content .= " \n\n"; + $content .= "\n
    +

    + (%d/%d) + %s +

    +

    %s

    +
    '; if ($trace['function']) { - $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); + $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); } if (isset($trace['file']) && isset($trace['line'])) { $content .= $this->formatPath($trace['file'], $trace['line']); } - $content .= "\n"; + $content .= "
    \n
    \n"; } } catch (\Exception $e) { // something nasty happened and we cannot throw an exception anymore @@ -253,9 +255,19 @@ public function getContent(FlattenException $exception) } } + $symfonyGhostImageContents = $this->getSymfonyGhostAsSvg(); + return << -

    $title

    +
    +
    +
    +

    $title

    +
    $symfonyGhostImageContents
    +
    +
    +
    + +
    $content
    EOF; @@ -271,48 +283,52 @@ public function getContent(FlattenException $exception) public function getStylesheet(FlattenException $exception) { return <<<'EOF' - .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 } - .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; } - .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; } - .sf-reset .clear_fix { display:inline-block; } - .sf-reset * html .clear_fix { height:1%; } - .sf-reset .clear_fix { display:block; } - .sf-reset, .sf-reset .block { margin: auto } - .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; } - .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px } - .sf-reset strong { font-weight:bold; } - .sf-reset a { color:#6c6159; cursor: default; } - .sf-reset a img { border:none; } - .sf-reset a:hover { text-decoration:underline; } - .sf-reset em { font-style:italic; } - .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif } - .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; } - .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; } - .sf-reset .exception_message { margin-left: 3em; display: block; } - .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; } - .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px; - border-bottom-right-radius: 16px; - border-bottom-left-radius: 16px; - border-bottom:1px solid #ccc; - border-right:1px solid #ccc; - border-left:1px solid #ccc; - word-wrap: break-word; - } - .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px; - border-top-left-radius: 16px; - border-top-right-radius: 16px; - border-top:1px solid #ccc; - border-right:1px solid #ccc; - border-left:1px solid #ccc; - overflow: hidden; - word-wrap: break-word; - } - .sf-reset a { background:none; color:#868686; text-decoration:none; } - .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; } - .sf-reset ol { padding: 10px 0; } - .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px; - border-radius: 10px; - border: 1px solid #ccc; + body { background-color: #F9F9F9; color: #222; font: 14px/1.4 Helvetica, Arial, sans-serif; margin: 0; padding-bottom: 45px; } + + a { cursor: pointer; text-decoration: none; } + a:hover { text-decoration: underline; } + abbr[title] { border-bottom: none; cursor: help; text-decoration: none; } + + code, pre { font: 13px/1.5 Consolas, Monaco, Menlo, "Ubuntu Mono", "Liberation Mono", monospace; } + + table, tr, th, td { background: #FFF; border-collapse: collapse; vertical-align: top; } + table { background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2); margin: 1em 0; width: 100%; } + table th, table td { border: solid #E0E0E0; border-width: 1px 0; padding: 8px 10px; } + table th { background-color: #E0E0E0; font-weight: bold; text-align: left; } + + .hidden-xs-down { display: none; } + .block { display: block; } + .break-long-words { -ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } + .text-muted { color: #999; } + + .container { max-width: 1024px; margin: 0 auto; padding: 0 15px; } + .container::after { content: ""; display: table; clear: both; } + + .exception-summary { background: #B0413E; border-bottom: 2px solid rgba(0, 0, 0, 0.1); border-top: 1px solid rgba(0, 0, 0, .3); flex: 0 0 auto; margin-bottom: 30px; } + + .exception-message-wrapper { display: flex; align-items: center; min-height: 70px; } + .exception-message { flex-grow: 1; padding: 30px 0; } + .exception-message, .exception-message a { color: #FFF; font-size: 21px; font-weight: 400; margin: 0; } + .exception-message.long { font-size: 18px; } + .exception-message a { text-decoration: none; } + .exception-message a:hover { text-decoration: underline; } + + .exception-illustration { flex-basis: 111px; flex-shrink: 0; height: 66px; margin-left: 15px; opacity: .7; } + + .trace + .trace { margin-top: 30px; } + .trace-head { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } + .trace-head .trace-class { color: #222; font-size: 18px; font-weight: bold; line-height: 1.3; margin: 0; position: relative; } + + .trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; } + + .trace-file-path, .trace-file-path a { margin-top: 3px; color: #999; color: #795da3; color: #B0413E; color: #222; font-size: 13px; } + .trace-class { color: #B0413E; } + .trace-type { padding: 0 2px; } + .trace-method { color: #B0413E; color: #222; font-weight: bold; color: #B0413E; } + .trace-arguments { color: #222; color: #999; font-weight: normal; color: #795da3; color: #777; padding-left: 2px; } + + @media (min-width: 575px) { + .hidden-xs-down { display: initial; } } EOF; } @@ -325,17 +341,9 @@ private function decorate($content, $css) - + - + $content @@ -355,10 +363,10 @@ private function formatPath($path, $line) $fmt = $this->fileLinkFormat; if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $path, '%l' => $line)) : $fmt->format($path, $line)) { - return sprintf(' in %s line %d', $this->escapeHtml($link), $file, $line); + return sprintf('in %s (line %d)', $this->escapeHtml($link), $file, $line); } - return sprintf(' in %s line %d', $this->escapeHtml($path), $file, $line); + return sprintf('in %s (line %d)', $this->escapeHtml($path), $file, $line); } /** @@ -399,4 +407,9 @@ private function escapeHtml($str) { return htmlspecialchars($str, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset); } + + private function getSymfonyGhostAsSvg() + { + return ''; + } } diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index b3701284d4443..0285eff1346cb 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -39,8 +39,8 @@ public function testDebug() $handler->sendPhpResponse(new \RuntimeException('Foo')); $response = ob_get_clean(); - $this->assertContains('

    Whoops, looks like something went wrong.

    ', $response); - $this->assertNotContains('

    ', $response); + $this->assertContains('Whoops, looks like something went wrong.', $response); + $this->assertNotContains('
    ', $response); $handler = new ExceptionHandler(true); @@ -48,8 +48,8 @@ public function testDebug() $handler->sendPhpResponse(new \RuntimeException('Foo')); $response = ob_get_clean(); - $this->assertContains('

    Whoops, looks like something went wrong.

    ', $response); - $this->assertContains('

    ', $response); + $this->assertContains('Whoops, looks like something went wrong.', $response); + $this->assertContains('
    ', $response); } public function testStatusCode() @@ -94,7 +94,7 @@ public function testNestedExceptions() $handler->sendPhpResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar'))); $response = ob_get_clean(); - $this->assertStringMatchesFormat('%AFoo%ABar%A', $response); + $this->assertStringMatchesFormat('%A

    Foo

    %A

    Bar

    %A', $response); } public function testHandle() From 01ca2417446c37c5f45995ba090fdadf5e674490 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 27 May 2017 23:29:56 +0200 Subject: [PATCH 67/75] [Console] Fix tests --- .../Component/Console/Tests/Helper/QuestionHelperTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index a9be2059545c9..590c8cf30e54d 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -278,14 +278,14 @@ public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer ); $dialog = new QuestionHelper(); - $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); + $inputStream = $this->getInputStream($providedAnswer."\n"); $helperSet = new HelperSet(array(new FormatterHelper())); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the directory', $possibleChoices); $question->setMaxAttempts(1); $question->setMultiselect(true); - $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + $answer = $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question); $this->assertSame($expectedValue, $answer); } From 5e6b3a5886144ec9f2b0568b21773c1551b1527c Mon Sep 17 00:00:00 2001 From: HeahDude Date: Sun, 28 May 2017 02:20:58 +0200 Subject: [PATCH 68/75] Fixed options stub values display in form profiler --- .../Resources/views/Collector/form.html.twig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 90b268fd4fb76..2f8b83049d158 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig @@ -624,7 +624,10 @@ {{ option }} {{ profiler_dump(value) }} - {% if data.resolved_options[option] == value %} + {# values can be stubs #} + {% set option_value = value.value|default(value) %} + {% set resolved_option_value = data.resolved_options[option].value|default(data.resolved_options[option]) %} + {% if resolved_option_value == option_value %} same as passed value {% else %} {{ profiler_dump(data.resolved_options[option]) }} From 029f89a7ff42f98394ddcd9e5e7afc5a0837652a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 28 May 2017 12:47:43 +0200 Subject: [PATCH 69/75] typo --- src/Symfony/Component/Cache/Adapter/RedisAdapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php index f84ffa5e48a2a..922d3d3e5150b 100644 --- a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php @@ -306,10 +306,10 @@ private function pipeline(\Closure $generator) } elseif ($this->redis instanceof \RedisCluster) { // phpredis doesn't support pipelining with RedisCluster // see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining - $result = array(); + $results = array(); foreach ($generator() as $command => $args) { + $results[] = call_user_func_array(array($this->redis, $command), $args); $ids[] = $args[0]; - $result[] = call_user_func_array(array($this->redis, $command), $args); } } else { $this->redis->multi(\Redis::PIPELINE); From 934c0c0e9c71421a36ed1fef6f2efa305548b36f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 28 May 2017 13:10:04 +0200 Subject: [PATCH 70/75] Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)" This reverts commit cfb090d1c5d60a881bc30d32f4953eb2683439c6, reversing changes made to 4e8f403a7c4c2859fa5116cc68f31c55288a9ca7. --- src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php | 2 +- src/Symfony/Bridge/PhpUnit/TextUI/Command.php | 2 +- src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php index 6d467b35647ec..f85dbb367ca9c 100644 --- a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php +++ b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; -if (class_exists('PHPUnit_Framework_BaseTestListener') && !class_exists('PHPUnit\Framework\BaseTestListener')) { +if (class_exists('PHPUnit_Framework_BaseTestListener')) { class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\SymfonyTestsListener'); return; diff --git a/src/Symfony/Bridge/PhpUnit/TextUI/Command.php b/src/Symfony/Bridge/PhpUnit/TextUI/Command.php index 90936c847b022..77b617fdcc269 100644 --- a/src/Symfony/Bridge/PhpUnit/TextUI/Command.php +++ b/src/Symfony/Bridge/PhpUnit/TextUI/Command.php @@ -13,7 +13,7 @@ use PHPUnit\TextUI\Command as BaseCommand; -if (class_exists('PHPUnit_TextUI_Command') && !class_exists('PHPUnit\TextUI\Command')) { +if (class_exists('PHPUnit_TextUI_Command')) { class_alias('Symfony\Bridge\PhpUnit\Legacy\Command', 'Symfony\Bridge\PhpUnit\TextUI\Command'); return; diff --git a/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php b/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php index 7351009e8880d..2d18b4f9afa2b 100644 --- a/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php +++ b/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php @@ -14,7 +14,7 @@ use PHPUnit\TextUI\TestRunner as BaseRunner; use Symfony\Bridge\PhpUnit\SymfonyTestsListener; -if (class_exists('PHPUnit_TextUI_Command') && !class_exists('PHPUnit\TextUI\Command')) { +if (class_exists('PHPUnit_TextUI_Command')) { class_alias('Symfony\Bridge\PhpUnit\Legacy\TestRunner', 'Symfony\Bridge\PhpUnit\TextUI\TestRunner'); return; From 96e307fd5c49af88ccb581efbb61cc0d0287ca3f Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Mon, 22 May 2017 10:45:15 +0200 Subject: [PATCH 71/75] [Console] ChoiceQuestion must have choices --- .../Component/Console/Question/ChoiceQuestion.php | 4 ++++ .../Console/Tests/Helper/QuestionHelperTest.php | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index e5b6ff4ad7217..f07ace4b161ec 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -32,6 +32,10 @@ class ChoiceQuestion extends Question */ public function __construct($question, array $choices, $default = null) { + if (!$choices) { + throw new \LogicException('Choice question must have at least 1 choice available.'); + } + parent::__construct($question, $default); $this->choices = $choices; diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 49ba0ee06c79a..2309965deeff8 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -434,6 +434,15 @@ public function testAskThrowsExceptionOnMissingInputWithValidator() $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage Choice question must have at least 1 choice available. + */ + public function testEmptyChoices() + { + new ChoiceQuestion('Question', array(), 'irrelevant'); + } + protected function getInputStream($input) { $stream = fopen('php://memory', 'r+', false); From 43636ba6307250bed48ed86fdd3d9f42e2fbf2d4 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 29 May 2017 09:23:31 +0200 Subject: [PATCH 72/75] [Form] fix guesed value param type in docblock --- src/Symfony/Component/Form/Guess/ValueGuess.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Form/Guess/ValueGuess.php b/src/Symfony/Component/Form/Guess/ValueGuess.php index fe40e020ccab8..9a46207eefe42 100644 --- a/src/Symfony/Component/Form/Guess/ValueGuess.php +++ b/src/Symfony/Component/Form/Guess/ValueGuess.php @@ -18,19 +18,14 @@ */ class ValueGuess extends Guess { - /** - * The guessed value. - * - * @var array - */ private $value; /** * Constructor. * - * @param string $value The guessed value - * @param int $confidence The confidence that the guessed class name - * is correct + * @param string|int|bool|null $value The guessed value + * @param int $confidence The confidence that the guessed class name + * is correct */ public function __construct($value, $confidence) { @@ -42,7 +37,7 @@ public function __construct($value, $confidence) /** * Returns the guessed value. * - * @return mixed + * @return string|int|bool|null */ public function getValue() { From 7b4066e8ab3cb024899cbff557f88d03b9758edb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 29 May 2017 10:09:00 +0200 Subject: [PATCH 73/75] [Config] Fallback to regular import when glob fails --- .../Component/Config/Loader/FileLoader.php | 15 +++++++-------- .../Config/Tests/Loader/FileLoaderTest.php | 8 ++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index 6119e5a5b1118..d3fe0eacfc0d9 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -83,18 +83,17 @@ public function getLocator() */ public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null) { - $ret = array(); - $ct = 0; - if (!is_string($resource) || false === strpbrk($resource, '*?{[')) { - $ret[] = $this->doImport($resource, $type, $ignoreErrors, $sourceResource); - } else { - foreach ($this->glob($resource, false, $_, $ignoreErrors) as $path => $info) { - ++$ct; + if (is_string($resource) && false !== strpbrk($resource, '*?{[')) { + $ret = array(); + foreach ($this->glob($resource, false, $_, true) as $path => $info) { $ret[] = $this->doImport($path, $type, $ignoreErrors, $sourceResource); } + if ($ret) { + return count($ret) > 1 ? $ret : $ret[0]; + } } - return $ct > 1 ? $ret : (isset($ret[0]) ? $ret[0] : null); + return $this->doImport($resource, $type, $ignoreErrors, $sourceResource); } /** diff --git a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php index e1d23e45fa6d1..59b625525bff1 100644 --- a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php @@ -66,6 +66,14 @@ public function testImportWithFileLocatorDelegation() $this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); } } + + public function testImportWithGlobLikeResource() + { + $locatorMock = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock(); + $loader = new TestFileLoader($locatorMock); + + $this->assertSame('[foo]', $loader->import('[foo]')); + } } class TestFileLoader extends FileLoader From 2b22ad5eb1db7f480934f705b7ebb76458400a2c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 May 2017 13:36:48 -0700 Subject: [PATCH 74/75] updated CHANGELOG for 3.3.0 --- CHANGELOG-3.3.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index 39137503cd411..17b9ed1ed3073 100644 --- a/CHANGELOG-3.3.md +++ b/CHANGELOG-3.3.md @@ -7,6 +7,45 @@ in 3.3 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.3.0...v3.3.1 +* 3.3.0 (2017-05-29) + + * bug #22940 [Config] Fallback to regular import when glob fails (nicolas-grekas) + * bug #22847 [Console] ChoiceQuestion must have choices (ro0NL) + * bug #22900 [FrameworkBundle][Console] Fix the override of a command registered by the kernel (aaa2000) + * bug #22930 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check (nicolas-grekas) + * bug #22910 [Filesystem] improve error handling in lock() (xabbuh) + * bug #22924 [Cache] Dont use pipelining with RedisCluster (nicolas-grekas) + * bug #22928 [WebProfilerBundle] Fixed options stub values display in form profiler (HeahDude) + * feature #22838 Make the simple exception pages match the new style (javiereguiluz) + * bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch) + * bug #22718 [Console] Fixed different behaviour of key and value user inputs in multiple choice question (borNfreee) + * bug #22921 [FrameworkBundle] Only override getProjectDir if it exists in the kernel (aschempp) + * feature #22905 [FrameworkBundle][Validator] Move the PSR-11 factory to the component (ogizanagi) + * bug #22728 [HttpKernel] Fix kernel.project_dir extensibility (chalasr) + * bug #22829 [Yaml] fix colon without space deprecation (xabbuh) + * bug #22901 Fix missing abstract key in XmlDumper (weaverryan) + * bug #22912 [DI] Avoid private call to Container::has() (ro0NL) + * feature #22904 [HttpFoundation] Add Request::HEADER_X_FORWARDED_AWS_ELB const (nicolas-grekas) + * bug #22878 [Yaml] parse PHP constants in mapping keys (xabbuh) + * bug #22873 [HttpKernel] don't call getTrustedHeaderName() if possible (xabbuh) + * feature #22892 [ProxyManager] Add FC layer (nicolas-grekas) + * bug #22866 [DI] Check for privates before shared services (ro0NL) + * feature #22884 [DI] Add missing deprecation on Extension::getClassesToCompile (nicolas-grekas) + * bug #22874 [WebProfilerBundle] Fix sub-requests display in time profiler panel (nicolas-grekas) + * bug #22853 [Yaml] fix multiline block handling (xabbuh) + * bug #22872 [FrameworkBundle] Handle project dir in cache:clear command (nicolas-grekas) + * feature #22808 [FrameworkBundle][Validator] Deprecate passing validator instances/aliases over using the service locator (ogizanagi) + * bug #22857 [DI] Fix autowire error for inlined services (weaverryan) + * bug #22858 [SecurityBundle] Prevent auto-registration of UserPasswordEncoderCommand (chalasr) + * bug #22859 [Profiler][VarDumper] Fix searchbar css when in toolbar (ogizanagi) + * bug #22614 [Process] Fixed escaping arguments on Windows when inheritEnvironmentVariables is set to false (maryo) + * bug #22817 [PhpUnitBridge] optional error handler arguments (xabbuh) + * bug #22781 [DI][Serializer] Fix missing de(normalizer|coder) autoconfig (ogizanagi) + * bug #22790 [DependencyInjection] Fix dumping of RewindableGenerator with empty IteratorArgument (meyerbaptiste) + * bug #22787 [MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows (ChadSikorra) + * bug #22768 Use 0.0.0.0 as the server log command host default. (ChadSikorra) + * bug #22752 Improved how profiler errors are displayed on small screens (javiereguiluz) + * 3.3.0-RC1 (2017-05-17) * bug #22715 [FrameworkBundle] remove Security deps from the require section (xabbuh) From e6eb52c5e040419eba6a82ae556ff44d926607b4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 May 2017 14:02:12 -0700 Subject: [PATCH 75/75] updated VERSION for 3.3.0 --- 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 b5df6c6cdb24d..e2f1df0351ad0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.0-DEV'; + const VERSION = '3.3.0'; const VERSION_ID = 30300; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; const RELEASE_VERSION = 0; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018';