From 36f16e8461290ec24888647ea7bb58759acdab5c Mon Sep 17 00:00:00 2001 From: Vincent Touzet Date: Tue, 28 May 2019 21:17:30 +0200 Subject: [PATCH 1/9] [FrameworkBundle] Add a validation on the messenger section --- .../DependencyInjection/Configuration.php | 4 +++ .../DependencyInjection/ConfigurationTest.php | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 44ed8213e9..ea64157fde 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1110,6 +1110,10 @@ class Configuration implements ConfigurationInterface ->{!class_exists(FullStack::class) && interface_exists(MessageBusInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}() ->fixXmlConfig('transport') ->fixXmlConfig('bus', 'buses') + ->validate() + ->ifTrue(function ($v) { return isset($v['buses']) && \count($v['buses']) > 1 && null === $v['default_bus']; }) + ->thenInvalid('You must specify the "default_bus" if you define more than one bus.') + ->end() ->children() ->arrayNode('routing') ->useAttributeAsKey('message_class') diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 79ebadef28..3980036006 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -188,6 +188,31 @@ class ConfigurationTest extends TestCase yield [$createPackageConfig($config), 'You cannot use both "version" and "json_manifest_path" at the same time under "assets" packages.']; } + public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefaultBus() + { + $expectedMessage = 'You must specify the "default_bus" if you define more than one bus.'; + if (method_exists($this, 'expectException')) { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage($expectedMessage); + } else { + $this->setExpectedException(InvalidConfigurationException::class, $expectedMessage); + } + $processor = new Processor(); + $configuration = new Configuration(true); + + $processor->processConfiguration($configuration, [ + 'framework' => [ + 'messenger' => [ + 'default_bus' => null, + 'buses' => [ + 'first_bus' => [], + 'second_bus' => [], + ], + ], + ], + ]); + } + protected static function getBundleDefaultConfig() { return [ From 7f00a7475481a462ac0c7c14802afca138c3502b Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 30 May 2019 05:17:01 +0200 Subject: [PATCH 2/9] [FrameworkBundle] fix test fixture using deprecated controller and add missing deprecation --- .../EventListener/ResolveControllerNameSubscriber.php | 4 +++- .../EventListener/ResolveControllerNameSubscriberTest.php | 3 +++ .../Tests/Functional/app/templates/fragment.html.twig | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php index e68ef896dd..709df23075 100644 --- a/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php +++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php @@ -37,7 +37,9 @@ class ResolveControllerNameSubscriber implements EventSubscriberInterface $controller = $event->getRequest()->attributes->get('_controller'); if (\is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) { // controller in the a:b:c notation then - $event->getRequest()->attributes->set('_controller', $this->parser->parse($controller, false)); + $event->getRequest()->attributes->set('_controller', $parsedNotation = $this->parser->parse($controller, false)); + + @trigger_error(sprintf('Referencing controllers with %s is deprecated since Symfony 4.1, use "%s" instead.', $controller, $parsedNotation), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php index 084e63ca95..c8bc4f8a85 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php @@ -20,6 +20,9 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; class ResolveControllerNameSubscriberTest extends TestCase { + /** + * @group legacy + */ public function testReplacesControllerAttribute() { $parser = $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/templates/fragment.html.twig b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/templates/fragment.html.twig index 4dea4b360b..6576e325a2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/templates/fragment.html.twig +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/templates/fragment.html.twig @@ -1,7 +1,7 @@ -{{ render(controller('TestBundle:Fragment:inlined', {'options': {'bar': bar, 'eleven': 11}})) }} +{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::inlinedAction', {'options': {'bar': bar, 'eleven': 11}})) }} -- -{{ render(controller('TestBundle:Fragment:customformat', {'_format': 'html'})) }} +{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customformatAction', {'_format': 'html'})) }} -- -{{ render(controller('TestBundle:Fragment:customlocale', {'_locale': 'es'})) }} +{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customlocaleAction', {'_locale': 'es'})) }} -- -{{ app.request.setLocale('fr') }}{{ render(controller('TestBundle:Fragment:forwardlocale')) -}} +{{ app.request.setLocale('fr') }}{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::forwardlocaleAction')) -}} From 65531c84992b5291db71c1f75108bef86fb769a2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 May 2019 08:20:59 +0200 Subject: [PATCH 3/9] updated CHANGELOG for 4.3.0 --- CHANGELOG-4.3.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-4.3.md b/CHANGELOG-4.3.md index 9f06cb0767..8f905cd7af 100644 --- a/CHANGELOG-4.3.md +++ b/CHANGELOG-4.3.md @@ -7,6 +7,10 @@ in 4.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/v4.3.0...v4.3.1 +* 4.3.0 (2019-05-30) + + * bug #31654 [HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping (vilius-g) + * 4.3.0-RC1 (2019-05-28) * bug #31650 Create an abstract HTTP transport and extend it in all HTTP transports (bocharsky-bw) From 090c029f21e0eeef768b66dbfa8e9961a24ab8ae Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 May 2019 08:21:08 +0200 Subject: [PATCH 4/9] updated VERSION for 4.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 0dcdc717d9..e0154b7d23 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.3.0-DEV'; + const VERSION = '4.3.0'; const VERSION_ID = 40300; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; const RELEASE_VERSION = 0; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2020'; const END_OF_LIFE = '07/2020'; From f9beee7424e81f593f8497a3b5ab973160935f2f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 May 2019 08:26:43 +0200 Subject: [PATCH 5/9] bumped Symfony version to 4.3.1 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index e0154b7d23..a1b81ed928 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.3.0'; - const VERSION_ID = 40300; + const VERSION = '4.3.1-DEV'; + const VERSION_ID = 40301; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; - const RELEASE_VERSION = 0; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 1; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2020'; const END_OF_LIFE = '07/2020'; From 3a88f11662e9bdd8cc22be25831ac0839b40688e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 30 May 2019 10:57:55 +0200 Subject: [PATCH 6/9] Use a more appropriate group when deprecating mode The deprecation comes from a vendor: the phpunit bridge itself, so it's either the direct or the indirect group. And since only the end user is supposed to set the group, then this is supposed to be a direct deprecation. --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index a1aee18b8c..55089e0be1 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -228,9 +228,9 @@ class DeprecationErrorHandler return $this->configuration = Configuration::inWeakMode(); } if (self::MODE_WEAK_VENDORS === $mode) { - ++$this->deprecations['remaining selfCount']; + ++$this->deprecations['remaining directCount']; $msg = sprintf('Setting SYMFONY_DEPRECATIONS_HELPER to "%s" is deprecated in favor of "max[self]=0"', $mode); - $ref = &$this->deprecations['remaining self'][$msg]['count']; + $ref = &$this->deprecations['remaining direct'][$msg]['count']; ++$ref; $mode = 'max[self]=0'; } From 33844376dafad207de784fd06e02f5ba1cc78ebf Mon Sep 17 00:00:00 2001 From: Chi-teck Date: Thu, 30 May 2019 14:28:08 +0500 Subject: [PATCH 7/9] Fix parameter documentation for Inflector::pluralize() method --- src/Symfony/Component/Inflector/Inflector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Inflector/Inflector.php b/src/Symfony/Component/Inflector/Inflector.php index 19edd1ae6a..15198293cf 100644 --- a/src/Symfony/Component/Inflector/Inflector.php +++ b/src/Symfony/Component/Inflector/Inflector.php @@ -410,7 +410,7 @@ final class Inflector * If the method can't determine the form with certainty, an array of the * possible plurals is returned. * - * @param string $singular A word in plural form + * @param string $singular A word in singular form * * @return string|array The plural form or an array of possible plural forms */ From 2da9e3f7171b2db0dc82fc2d946850595248a229 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 30 May 2019 11:47:28 +0200 Subject: [PATCH 8/9] [HttpClient] Minor fix in an error message --- src/Symfony/Component/HttpClient/Response/CurlResponse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/Response/CurlResponse.php b/src/Symfony/Component/HttpClient/Response/CurlResponse.php index 6af5f5af3d..8cb5081e70 100644 --- a/src/Symfony/Component/HttpClient/Response/CurlResponse.php +++ b/src/Symfony/Component/HttpClient/Response/CurlResponse.php @@ -260,7 +260,7 @@ final class CurlResponse implements ResponseInterface while ($info = curl_multi_info_read($multi->handle)) { $multi->handlesActivity[(int) $info['handle']][] = null; - $multi->handlesActivity[(int) $info['handle']][] = \in_array($info['result'], [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || (\CURLE_WRITE_ERROR === $info['result'] && 'destruct' === @curl_getinfo($info['handle'], CURLINFO_PRIVATE)) ? null : new TransportException(sprintf('%s for"%s".', curl_strerror($info['result']), curl_getinfo($info['handle'], CURLINFO_EFFECTIVE_URL))); + $multi->handlesActivity[(int) $info['handle']][] = \in_array($info['result'], [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || (\CURLE_WRITE_ERROR === $info['result'] && 'destruct' === @curl_getinfo($info['handle'], CURLINFO_PRIVATE)) ? null : new TransportException(sprintf('%s for "%s".', curl_strerror($info['result']), curl_getinfo($info['handle'], CURLINFO_EFFECTIVE_URL))); } } finally { self::$performing = false; From 6982025e3a8755b4659f28b1e36d2d7484acac69 Mon Sep 17 00:00:00 2001 From: Andrii Dembitskyi Date: Thu, 30 May 2019 10:50:58 +0300 Subject: [PATCH 9/9] Add missed use class for Symfony\Bundle\FrameworkBundle\Test\WebTestCase::$client --- src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php index 417556578b..caed6fe8a2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php @@ -23,7 +23,7 @@ abstract class WebTestCase extends KernelTestCase { use WebTestAssertionsTrait; - /** @var Client|null */ + /** @var KernelBrowser|null */ protected static $client; protected function doTearDown(): void