From f14d082fadac2761f913251b222dabdd75265257 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 18 Oct 2019 16:50:31 +0200 Subject: [PATCH 1/6] [Mailer][MailchimpBridge] Fix NamedAddress obsolete paths --- .../Mailchimp/Transport/MandrillApiTransport.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php index 57f024e5f6..067d57bd67 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php @@ -17,7 +17,6 @@ use Symfony\Component\Mailer\Exception\HttpTransportException; use Symfony\Component\Mailer\SentMessage; use Symfony\Component\Mailer\Transport\AbstractApiTransport; use Symfony\Component\Mime\Email; -use Symfony\Component\Mime\NamedAddress; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; @@ -76,15 +75,12 @@ class MandrillApiTransport extends AbstractApiTransport 'html' => $email->getHtmlBody(), 'text' => $email->getTextBody(), 'subject' => $email->getSubject(), + 'from_name' => $envelope->getSender()->getName(), 'from_email' => $envelope->getSender()->getAddress(), 'to' => $this->getRecipients($email, $envelope), ], ]; - if ($envelope->getSender() instanceof NamedAddress) { - $payload['message']['from_name'] = $envelope->getSender()->getName(); - } - foreach ($email->getAttachments() as $attachment) { $headers = $attachment->getPreparedHeaders(); $disposition = $headers->getHeaderBody('Content-Disposition'); @@ -126,13 +122,10 @@ class MandrillApiTransport extends AbstractApiTransport $recipientPayload = [ 'email' => $recipient->getAddress(), + 'name' => $recipient->getName(), 'type' => $type, ]; - if ($recipient instanceof NamedAddress) { - $recipientPayload['name'] = $recipient->getName(); - } - $recipients[] = $recipientPayload; } From 18cc561754fca7c68219681d8e7a57d10ed66a3e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 19 Oct 2019 10:14:32 +0200 Subject: [PATCH 2/6] execute all compatible tests across versions --- .../Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php | 2 +- src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php | 2 +- src/Symfony/Component/Form/Tests/VersionAwareTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php index e5d4303911..d7d7cae5ec 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php @@ -30,7 +30,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase */ private $em; - protected static $supportedFeatureSetVersion = 304; + protected static $supportedFeatureSetVersion = 403; protected function getExtensions() { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 0f530d37d6..ebffc57c1d 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -58,7 +58,7 @@ class EntityTypeTest extends BaseTypeTest */ private $emRegistry; - protected static $supportedFeatureSetVersion = 304; + protected static $supportedFeatureSetVersion = 403; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/VersionAwareTest.php b/src/Symfony/Component/Form/Tests/VersionAwareTest.php index 2b8489a6a2..578bebcb08 100644 --- a/src/Symfony/Component/Form/Tests/VersionAwareTest.php +++ b/src/Symfony/Component/Form/Tests/VersionAwareTest.php @@ -13,7 +13,7 @@ namespace Symfony\Component\Form\Tests; trait VersionAwareTest { - protected static $supportedFeatureSetVersion = 304; + protected static $supportedFeatureSetVersion = 403; /** * @param int $requiredFeatureSetVersion From d91b87f483eee1cac1229db7720c7a5f61054b10 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 19 Oct 2019 10:26:53 +0200 Subject: [PATCH 3/6] bump Form component compatibility versions --- .../Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php | 2 +- src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php | 2 +- .../Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php | 2 +- src/Symfony/Component/Form/Tests/VersionAwareTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php index d7d7cae5ec..53be11f6d1 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php @@ -30,7 +30,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase */ private $em; - protected static $supportedFeatureSetVersion = 403; + protected static $supportedFeatureSetVersion = 404; protected function getExtensions() { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 8c57854bd6..7eba2b4595 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -58,7 +58,7 @@ class EntityTypeTest extends BaseTypeTest */ private $emRegistry; - protected static $supportedFeatureSetVersion = 403; + protected static $supportedFeatureSetVersion = 404; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php index af4878ad3a..d7868b274b 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\Tests\AbstractLayoutTest; abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest { - protected static $supportedFeatureSetVersion = 403; + protected static $supportedFeatureSetVersion = 404; public function testLabelOnForm() { diff --git a/src/Symfony/Component/Form/Tests/VersionAwareTest.php b/src/Symfony/Component/Form/Tests/VersionAwareTest.php index 578bebcb08..c555b2499d 100644 --- a/src/Symfony/Component/Form/Tests/VersionAwareTest.php +++ b/src/Symfony/Component/Form/Tests/VersionAwareTest.php @@ -13,7 +13,7 @@ namespace Symfony\Component\Form\Tests; trait VersionAwareTest { - protected static $supportedFeatureSetVersion = 403; + protected static $supportedFeatureSetVersion = 404; /** * @param int $requiredFeatureSetVersion From 217058b47561f2b7457a695ca61fc5c419383e46 Mon Sep 17 00:00:00 2001 From: Gerhard Seidel Date: Fri, 18 Oct 2019 13:11:49 +0200 Subject: [PATCH 4/6] [Routing] fix route loading with wildcard, but dir or file is empty --- .../Routing/Loader/Configurator/RoutingConfigurator.php | 3 ++- src/Symfony/Component/Routing/Loader/XmlFileLoader.php | 2 +- src/Symfony/Component/Routing/Loader/YamlFileLoader.php | 2 +- .../Tests/Fixtures/controller/empty_wildcard/.gitignore | 0 .../Tests/Fixtures/import_with_name_prefix/routing.yml | 4 ++++ 5 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Component/Routing/Tests/Fixtures/controller/empty_wildcard/.gitignore diff --git a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php index a315cfb4ad..849db56759 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php @@ -39,7 +39,8 @@ class RoutingConfigurator final public function import($resource, $type = null, $ignoreErrors = false) { $this->loader->setCurrentDir(\dirname($this->path)); - $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file); + $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file) ?? []; + if (!\is_array($imported)) { return new ImportConfigurator($this->collection, $imported); } diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index ed4faf3915..7b5998bd20 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -169,7 +169,7 @@ class XmlFileLoader extends FileLoader $this->setCurrentDir(\dirname($path)); /** @var RouteCollection[] $imported */ - $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file); + $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file) ?? []; if (!\is_array($imported)) { $imported = [$imported]; diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index 15c223ecad..339776c13f 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -187,7 +187,7 @@ class YamlFileLoader extends FileLoader $this->setCurrentDir(\dirname($path)); - $imported = $this->import($config['resource'], $type, false, $file); + $imported = $this->import($config['resource'], $type, false, $file) ?? []; if (!\is_array($imported)) { $imported = [$imported]; diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/controller/empty_wildcard/.gitignore b/src/Symfony/Component/Routing/Tests/Fixtures/controller/empty_wildcard/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/import_with_name_prefix/routing.yml b/src/Symfony/Component/Routing/Tests/Fixtures/import_with_name_prefix/routing.yml index 90dce0ea1b..057b7b2d6b 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/import_with_name_prefix/routing.yml +++ b/src/Symfony/Component/Routing/Tests/Fixtures/import_with_name_prefix/routing.yml @@ -5,3 +5,7 @@ api: resource: ../controller/routing.yml name_prefix: api_ prefix: /api + +empty_wildcard: + resource: ../controller/empty_wildcard/* + prefix: /empty_wildcard From a54ecb0fae7ea9fbbf9bc9c6f5715d0ec235a9e5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 19 Oct 2019 15:04:41 +0200 Subject: [PATCH 5/6] bug #34024 [Routing] fix route loading with wildcard, but dir or file is empty (gseidel) This PR was merged into the 4.3 branch. Discussion ---------- [Routing] fix route loading with wildcard, but dir or file is empty | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | no ticket i see so far | License | MIT In my route config i have something like: ```yaml empty_wildcard: resource: ../controller/empty_wildcard/* prefix: /empty_wildcard ``` But ``empty_wildcard`` is empty or has no route configured. So i had this error: ``Call to a member function addPrefix() on null`` This PR take care if no route is configured, there will be no error. Commits ------- 217058b475 [Routing] fix route loading with wildcard, but dir or file is empty --- .../Routing/Loader/Configurator/RoutingConfigurator.php | 3 ++- src/Symfony/Component/Routing/Loader/XmlFileLoader.php | 3 ++- src/Symfony/Component/Routing/Loader/YamlFileLoader.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php index 7614caea3d..d0cc02d1c3 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php @@ -39,7 +39,8 @@ class RoutingConfigurator final public function import($resource, $type = null, $ignoreErrors = false) { $this->loader->setCurrentDir(\dirname($this->path)); - $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file); + $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file) ?: []; + if (!\is_array($imported)) { return new ImportConfigurator($this->collection, $imported); } diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index c114310fc3..29dfdb1665 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -146,7 +146,8 @@ class XmlFileLoader extends FileLoader $this->setCurrentDir(\dirname($path)); - $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file); + /** @var RouteCollection[] $imported */ + $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file) ?: []; if (!\is_array($imported)) { $imported = [$imported]; diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index bc21e9cb4d..568827695b 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -158,7 +158,7 @@ class YamlFileLoader extends FileLoader $this->setCurrentDir(\dirname($path)); - $imported = $this->import($config['resource'], $type, false, $file); + $imported = $this->import($config['resource'], $type, false, $file) ?: []; if (!\is_array($imported)) { $imported = [$imported]; From 4ad09ebafb1570878264aa49a73aab63c52a5aa2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 20 Oct 2019 11:47:57 +0200 Subject: [PATCH 6/6] [HttpKernel] fix wrong removal of the just generated container dir --- src/Symfony/Component/HttpKernel/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 325ef4d443..b05e877d7b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -868,7 +868,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $fs->dumpFile($dir.$file, $code); @chmod($dir.$file, 0666 & ~umask()); } - $legacyFile = \dirname($dir.$file).'.legacy'; + $legacyFile = \dirname($dir.key($content)).'.legacy'; if (file_exists($legacyFile)) { @unlink($legacyFile); }