diff --git a/CHANGELOG-4.2.md b/CHANGELOG-4.2.md index f45e7e7273ab4..7c7c018037c6d 100644 --- a/CHANGELOG-4.2.md +++ b/CHANGELOG-4.2.md @@ -7,6 +7,35 @@ in 4.2 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.2.0...v4.2.1 +* 4.2.9 (2019-05-28) + + * bug #31584 [Workflow] Do not trigger extra guards (lyrixx) + * bug #31632 [Messenger] Use "real" memory usage to honor --memory-limit (chalasr) + * bug #31599 [Translation] Fixed issue with new vs old TranslatorInterface in TranslationDataCollector (althaus) + * bug #31349 [WebProfilerBundle] Use absolute URL for profiler links (Alumbrados) + * bug #31541 [DI] fix using bindings with locators of service subscribers (nicolas-grekas) + * bug #31568 [Process] Fix infinite waiting for stopped process (mshavliuk) + * bug #31551 [ProxyManager] isProxyCandidate() does not take into account interfaces (andrerom) + * bug #31335 [Doctrine] Respect parent class contract in ContainerAwareEventManager (Koc) + * bug #31421 [Routing][AnnotationClassLoader] fix utf-8 encoding in default route name (przemyslaw-bogusz) + * bug #31510 Use the current working dir as default first arg in 'link' binary (lyrixx) + * bug #31524 [HttpFoundation] prevent deprecation when filesize matches error code (xabbuh) + * bug #31535 [Debug] Wrap call to require_once in a try/catch (lyrixx) + * bug #31477 [PropertyAccess] Add missing property to PropertyAccessor (vudaltsov) + * bug #31479 [Cache] fix saving unrelated keys in recursive callback calls (nicolas-grekas) + * bug #31438 [Serializer] Fix denormalization of object with variadic constructor typed argument (ajgarlag) + * bug #31445 [Messenger] Making cache rebuild correctly when message subscribers change (weaverryan) + * bug #31442 [Validator] Fix finding translator parent definition in compiler pass (deguif) + * bug #31475 [HttpFoundation] Allow set 'None' on samesite cookie flag (markitosgv) + * bug #31456 Remove deprecated usage of some Twig features (fabpot) + * bug #31207 [Routing] Fixed unexpected 404 NoConfigurationException (yceruto) + * bug #31261 [Console] Commands with an alias should not be recognized as ambiguous when using register (Simperfit) + * bug #31371 [DI] Removes number of elements information in debug mode (jschaedl) + * bug #31418 [FrameworkBundle] clarify the possible class/interface of the cache (xabbuh) + * bug #31411 [Intl] Fix root fallback locale (ro0NL) + * bug #31377 [Console] Fix auto-complete for ChoiceQuestion (multi-select answers) (battye) + * bug #31380 [WebProfilerBundle] Don't filter submitted IP values (javiereguiluz) + * 4.2.8 (2019-05-01) * bug #31338 Revert "bug #30620 [FrameworkBundle][HttpFoundation] make session service resettable (dmaicher)" (nicolas-grekas) diff --git a/CHANGELOG-4.3.md b/CHANGELOG-4.3.md index 9f06cb0767017..8f905cd7afcc5 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) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 44ed8213e916d..ea64157fde9bc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1110,6 +1110,10 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode) ->{!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/EventListener/ResolveControllerNameSubscriber.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php index e68ef896ddfd7..709df23075a54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php +++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php @@ -37,7 +37,9 @@ public function onKernelRequest(GetResponseEvent $event) $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/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 79ebadef28439..3980036006b11 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -188,6 +188,31 @@ public function provideInvalidAssetConfigurationTests() 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 [ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php index 084e63ca95ea5..c8bc4f8a854c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php @@ -20,6 +20,9 @@ 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 4dea4b360b68b..6576e325a2c23 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')) -}} diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php index bded60a7de62f..490e878b7bcd8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php @@ -122,6 +122,17 @@ public function testIntlTimeZoneInput() */ public function testIntlTimeZoneInputWithBc() { + $reflector = new \ReflectionExtension('intl'); + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches); + $tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0; + + if (!$tzDbVersion || 2017 <= $tzDbVersion) { + $this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion); + } + $form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone']); $form->submit('Europe/Saratov'); @@ -134,6 +145,17 @@ public function testIntlTimeZoneInputWithBc() */ public function testIntlTimeZoneInputWithBcAndIntl() { + $reflector = new \ReflectionExtension('intl'); + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches); + $tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0; + + if (!$tzDbVersion || 2017 <= $tzDbVersion) { + $this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion); + } + $form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'intltimezone', 'intl' => true]); $form->submit('Europe/Saratov'); diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 115f486f023f5..e217820950057 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -223,12 +223,17 @@ public function prepare(Request $request) list($pathPrefix, $location) = $part; if (substr($path, 0, \strlen($pathPrefix)) === $pathPrefix) { $path = $location.substr($path, \strlen($pathPrefix)); + // Only set X-Accel-Redirect header if a valid URI can be produced + // as nginx does not serve arbitrary file paths. + $this->headers->set($type, $path); + $this->maxlen = 0; break; } } + } else { + $this->headers->set($type, $path); + $this->maxlen = 0; } - $this->headers->set($type, $path); - $this->maxlen = 0; } elseif ($request->headers->has('Range')) { // Process the range headers. if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index 9f3beb08d1af3..effffe925be85 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -339,6 +339,7 @@ public function getSampleXAccelMappings() ['/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'], ['/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'], ['/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'], + ['/tmp/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', null], ]; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 03a7b7d9b8682..261c9d3e0599b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -43,7 +43,8 @@ public function testConstructorWithSimpleTypes() $this->assertSame('0', $response->getContent()); $response = new JsonResponse(0.1); - $this->assertSame('0.1', $response->getContent()); + $this->assertEquals('0.1', $response->getContent()); + $this->assertInternalType('string', $response->getContent()); $response = new JsonResponse(true); $this->assertSame('true', $response->getContent()); @@ -131,7 +132,8 @@ public function testStaticCreateWithSimpleTypes() $response = JsonResponse::create(0.1); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('0.1', $response->getContent()); + $this->assertEquals('0.1', $response->getContent()); + $this->assertInternalType('string', $response->getContent()); $response = JsonResponse::create(true); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 785ce496f5d49..e0154b7d23bb5 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-RC1'; + const VERSION = '4.3.0'; const VERSION_ID = 40300; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; const RELEASE_VERSION = 0; - const EXTRA_VERSION = 'RC1'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2020'; const END_OF_LIFE = '07/2020'; diff --git a/src/Symfony/Component/Intl/Data/Provider/LanguageDataProvider.php b/src/Symfony/Component/Intl/Data/Provider/LanguageDataProvider.php index fed764d6726e1..0d1bfe61df409 100644 --- a/src/Symfony/Component/Intl/Data/Provider/LanguageDataProvider.php +++ b/src/Symfony/Component/Intl/Data/Provider/LanguageDataProvider.php @@ -18,7 +18,7 @@ * * @author Bernhard Schussek * - * @internal + * @internal to be removed in 5.0. */ class LanguageDataProvider { @@ -37,17 +37,11 @@ public function __construct(string $path, BundleEntryReaderInterface $reader) $this->reader = $reader; } - /** - * @internal to be removed in 5.0. - */ public function getLanguages() { return $this->reader->readEntry($this->path, 'meta', ['Languages']); } - /** - * @internal to be removed in 5.0. - */ public function getAliases() { return $this->reader->readEntry($this->path, 'root', ['Aliases']); @@ -62,9 +56,6 @@ public function getName($language, $displayLocale = null) return $this->reader->readEntry($this->path, $displayLocale, ['Names', $language]); } - /** - * @internal to be removed in 5.0. - */ public function getNames($displayLocale = null) { if (null === $displayLocale) { @@ -83,9 +74,6 @@ public function getNames($displayLocale = null) return $languages; } - /** - * @internal to be removed in 5.0. - */ public function getAlpha3Code($language) { return $this->reader->readEntry($this->path, 'meta', ['Alpha2ToAlpha3', $language]); diff --git a/src/Symfony/Component/Intl/Data/Provider/RegionDataProvider.php b/src/Symfony/Component/Intl/Data/Provider/RegionDataProvider.php index ec16994f63a6f..881529440141d 100644 --- a/src/Symfony/Component/Intl/Data/Provider/RegionDataProvider.php +++ b/src/Symfony/Component/Intl/Data/Provider/RegionDataProvider.php @@ -18,7 +18,7 @@ * * @author Bernhard Schussek * - * @internal + * @internal to be removed in 5.0. */ class RegionDataProvider { @@ -37,9 +37,6 @@ public function __construct(string $path, BundleEntryReaderInterface $reader) $this->reader = $reader; } - /** - * @internal to be removed in 5.0. - */ public function getRegions() { return $this->reader->readEntry($this->path, 'meta', ['Regions']); @@ -54,9 +51,6 @@ public function getName($region, $displayLocale = null) return $this->reader->readEntry($this->path, $displayLocale, ['Names', $region]); } - /** - * @internal to be removed in 5.0. - */ public function getNames($displayLocale = null) { if (null === $displayLocale) { diff --git a/src/Symfony/Component/Intl/Data/Provider/ScriptDataProvider.php b/src/Symfony/Component/Intl/Data/Provider/ScriptDataProvider.php index 3189da13e5aaa..08bc3797262bd 100644 --- a/src/Symfony/Component/Intl/Data/Provider/ScriptDataProvider.php +++ b/src/Symfony/Component/Intl/Data/Provider/ScriptDataProvider.php @@ -18,7 +18,7 @@ * * @author Bernhard Schussek * - * @internal + * @internal to be removed in 5.0. */ class ScriptDataProvider { @@ -37,9 +37,6 @@ public function __construct(string $path, BundleEntryReaderInterface $reader) $this->reader = $reader; } - /** - * @internal to be removed in 5.0. - */ public function getScripts() { return $this->reader->readEntry($this->path, 'meta', ['Scripts']); @@ -54,9 +51,6 @@ public function getName($script, $displayLocale = null) return $this->reader->readEntry($this->path, $displayLocale, ['Names', $script]); } - /** - * @internal to be removed in 5.0. - */ public function getNames($displayLocale = null) { if (null === $displayLocale) { diff --git a/src/Symfony/Component/Intl/Tests/TimezonesTest.php b/src/Symfony/Component/Intl/Tests/TimezonesTest.php index cc000c148270c..ef922e1de866c 100644 --- a/src/Symfony/Component/Intl/Tests/TimezonesTest.php +++ b/src/Symfony/Component/Intl/Tests/TimezonesTest.php @@ -603,6 +603,15 @@ public function testForCountryCodeWithUnknownCountry() Timezones::forCountryCode('foobar'); } + /** + * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException + * @expectedExceptionMessage Country codes must be in uppercase, but "nl" was passed. Try with "NL" country code instead. + */ + public function testForCountryCodeWithWrongCountryCode() + { + Timezones::forCountryCode('nl'); + } + /** * @expectedException \Symfony\Component\Intl\Exception\MissingResourceException */ diff --git a/src/Symfony/Component/Intl/Timezones.php b/src/Symfony/Component/Intl/Timezones.php index 94afc7186062e..dd72d35925f40 100644 --- a/src/Symfony/Component/Intl/Timezones.php +++ b/src/Symfony/Component/Intl/Timezones.php @@ -109,6 +109,10 @@ public static function forCountryCode(string $country): array return []; } + if (Countries::exists(strtoupper($country))) { + throw new MissingResourceException(sprintf('Country codes must be in uppercase, but "%s" was passed. Try with "%s" country code instead.', $country, strtoupper($country))); + } + throw $e; } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php index c5dc5c40d458e..82a521d950a95 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php @@ -76,7 +76,7 @@ public function getValidTimezones(): iterable yield ['PST8PDT']; yield ['America/Montreal']; - // expired in ICU + // previously expired in ICU yield ['Europe/Saratov']; // standard @@ -316,6 +316,17 @@ public function getDeprecatedTimezones(): iterable */ public function testIntlCompatibility() { + $reflector = new \ReflectionExtension('intl'); + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + preg_match('/^ICU TZData version (?:=>)?(.*)$/m', $output, $matches); + $tzDbVersion = isset($matches[1]) ? (int) trim($matches[1]) : 0; + + if (!$tzDbVersion || 2017 <= $tzDbVersion) { + $this->markTestSkipped('"Europe/Saratov" is expired until 2017, current version is '.$tzDbVersion); + } + $constraint = new Timezone([ 'message' => 'myMessage', 'intlCompatible' => true,