From 5888566a89c71aeab8577807fd4d0bf436b2d07a Mon Sep 17 00:00:00 2001 From: Success Go Date: Wed, 12 Feb 2020 22:34:24 +0800 Subject: [PATCH 1/6] [HttpKernel] Fix method name in doc comments --- src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php index a10741a84d..a18fbd31f4 100644 --- a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; * current request. The propagation of this event is stopped as soon as a * response is set. * - * You can also call setException() to replace the thrown exception. This + * You can also call setThrowable() to replace the thrown exception. This * exception will be thrown if no response is set during processing of this * event. * From 707c5bade0dd7220b6d7e03dd7e27d66840edeb0 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Tue, 11 Feb 2020 11:52:39 +0100 Subject: [PATCH 2/6] [Console] Don't load same-namespace alternatives on exact match found --- src/Symfony/Component/Console/Application.php | 20 ++++++++++++--- .../Console/Tests/ApplicationTest.php | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 1463967ffa..280a34d5c5 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -645,7 +645,15 @@ class Application // filter out aliases for commands which are already on the list if (\count($commands) > 1) { $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands; - $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) { + + if (isset($commandList[$name])) { + return $this->get($name); + } + + foreach ($commands as $k => $nameOrAlias) { + if ($nameOrAlias === $name) { + return $this->get($nameOrAlias); + } if (!$commandList[$nameOrAlias] instanceof Command) { $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias); } @@ -654,8 +662,14 @@ class Application $aliases[$nameOrAlias] = $commandName; - return $commandName === $nameOrAlias || !\in_array($commandName, $commands); - })); + if ($commandName === $nameOrAlias || !\in_array($commandName, $commands)) { + continue; + } + + unset($commands[$k]); + } + + $commands = array_unique($commands); } $exact = \in_array($name, $commands, true) || isset($aliases[$name]); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 559c42599f..8288cfd326 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1642,6 +1642,31 @@ class ApplicationTest extends TestCase $this->assertArrayNotHasKey('disabled', $application->all()); } + public function testFindAlternativesDoesNotLoadSameNamespaceCommandsOnExactMatch() + { + $application = new Application(); + $application->setAutoExit(false); + + $loaded = []; + + $application->setCommandLoader(new FactoryCommandLoader([ + 'foo:bar' => function () use (&$loaded) { + $loaded['foo:bar'] = true; + + return (new Command('foo:bar'))->setCode(function () {}); + }, + 'foo' => function () use (&$loaded) { + $loaded['foo'] = true; + + return (new Command('foo'))->setCode(function () {}); + }, + ])); + + $application->run(new ArrayInput(['command' => 'foo']), new NullOutput()); + + $this->assertSame(['foo' => true], $loaded); + } + protected function getDispatcher($skipCommand = false) { $dispatcher = new EventDispatcher(); From 1c8fbe1cf9d5898094c3f88e582b37d6d4eaede4 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Thu, 13 Feb 2020 15:46:26 +0100 Subject: [PATCH 3/6] fix links to releases page (formerly known as "roadmap") --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .../Resources/views/Collector/config.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 57c1517854..859515b3ca 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -11,7 +11,7 @@ Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. -Additionally (see https://symfony.com/roadmap): +Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index 94912c5a71..58ec64d07e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -202,7 +202,7 @@ {{ collector.symfonyeom }} {{ collector.symfonyeol }} - View roadmap + View roadmap From 5825e3c58c1b047606ea4c8526b7d93ded2f9a4e Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Thu, 13 Feb 2020 16:21:59 +0100 Subject: [PATCH 4/6] fix anchor --- .../Resources/views/Collector/config.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index 58ec64d07e..b9d130b13e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -202,7 +202,7 @@ {{ collector.symfonyeom }} {{ collector.symfonyeol }} - View roadmap + View roadmap From e1713862997b29dd91f7203da0db6d4ef38355d6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 14 Feb 2020 07:56:04 +0100 Subject: [PATCH 5/6] sync validator translation files with master --- .../Validator/Resources/translations/validators.de.xlf | 4 ++++ .../Validator/Resources/translations/validators.en.xlf | 4 ++++ .../Validator/Resources/translations/validators.fr.xlf | 4 ++++ .../Validator/Resources/translations/validators.ru.xlf | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 8ee3120482..0702e8dfcd 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -366,6 +366,10 @@ This value should be between {{ min }} and {{ max }}. Dieser Wert sollte zwischen {{ min }} und {{ max }} sein. + + This value is not a valid hostname. + Dieser Wert ist kein gültiger Hostname. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index 100d552076..635e6736f6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -366,6 +366,10 @@ This value should be between {{ min }} and {{ max }}. This value should be between {{ min }} and {{ max }}. + + This value is not a valid hostname. + This value is not a valid hostname. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index dc7e73e3c7..4a7ab3538c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -366,6 +366,10 @@ This value should be between {{ min }} and {{ max }}. Cette valeur doit être comprise entre {{ min }} et {{ max }}. + + This value is not a valid hostname. + Cette valeur n'est pas un nom d'hôte valide. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf index 361be20f79..80911a9902 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf @@ -366,6 +366,10 @@ This value should be between {{ min }} and {{ max }}. Значение должно быть между {{ min }} и {{ max }}. + + This value is not a valid hostname. + Значение не является корректным именем хоста. + From 9e431038b204c6ebe53b2d628c0df52df086bd4a Mon Sep 17 00:00:00 2001 From: Christopher Hertel Date: Wed, 12 Feb 2020 22:21:47 +0100 Subject: [PATCH 6/6] fix unix root dir issue --- src/Symfony/Component/Finder/Finder.php | 4 ++++ .../Finder/Iterator/RecursiveDirectoryIterator.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index d2ea17d87a..33a76cc976 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -744,6 +744,10 @@ class Finder implements \IteratorAggregate, \Countable */ private function normalizeDir($dir) { + if ('/' === $dir) { + return $dir; + } + $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) { diff --git a/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php b/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php index ab48a2b8a1..63764d407d 100644 --- a/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php +++ b/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php @@ -74,7 +74,11 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator } $subPathname .= $this->getFilename(); - return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname); + if ('/' !== $basePath = $this->rootPath) { + $basePath .= $this->directorySeparator; + } + + return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname); } /**