From de4f8ac21d8d4d573fecca1748d84bb08b1eb079 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 28 Oct 2017 17:03:09 +0200 Subject: [PATCH 1/5] Added instructions to upgrade Symfony applications to 4.x --- UPGRADE-4.0.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index b1bfc21483..5daf146ed9 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -1,6 +1,40 @@ UPGRADE FROM 3.x to 4.0 ======================= +Symfony Framework +----------------- + +The first step to upgrade a Symfony 3.x application to 4.x is to update the +file and directory structure of your application: + +| Symfony 3.x | Symfony 4.x +| ----------------------------------- | -------------------------------- +| `app/config/` | `config/` +| `app/config/*.yml` | `config/*.yaml` and `config/packages/*.yaml` +| `app/config/parameters.yml.dist` | `config/services.yaml` and `.env.dist` +| `app/config/parameters.yml` | `config/services.yaml` and `.env` +| `app/Resources//views/` | `templates/bundles//` +| `app/Resources/` | `src/Resources/` +| `app/Resources/assets/` | `assets/` +| `app/Resources/translations/` | `translations/` +| `app/Resources/views/` | `templates/` +| `src/AppBundle/` | `src/` +| `var/logs/` | `var/log/` +| `web/` | `public/` +| `web/app.php` | `public/index.php` +| `web/app_dev.php` | `public/index.php` + +Then, upgrade the contents of your console script and your front controller: + +* `bin/console`: https://github.com/symfony/recipes/blob/master/symfony/console/3.3/bin/console +* `public/index.php`: https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/public/index.php + +Lastly, read the following article to add Symfony Flex to your application and +upgrade the configuration files: https://symfony.com/doc/current/setup/flex.html + +If you use Symfony components instead of the whole framework, you can find below +the upgrading instructions for each individual bundle and component. + ClassLoader ----------- From aca0ddd9d6911312db325ae294809fc4e8ea1ad3 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Sun, 19 Nov 2017 15:02:29 +1000 Subject: [PATCH 2/5] Add suggestions --- src/Symfony/Bridge/Monolog/composer.json | 3 ++- .../Bundle/WebServerBundle/Command/ServerLogCommand.php | 6 ++++++ src/Symfony/Bundle/WebServerBundle/composer.json | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index 23240155d2..51e0a7c803 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -31,7 +31,8 @@ "suggest": { "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.", - "symfony/event-dispatcher": "Needed when using log messages in console commands." + "symfony/event-dispatcher": "Needed when using log messages in console commands.", + "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." }, "autoload": { "psr-4": { "Symfony\\Bridge\\Monolog\\": "" }, diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php index eed32c5a20..5cef9e36d0 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\WebServerBundle\Command; +use Monolog\Formatter\FormatterInterface; use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; use Symfony\Bridge\Monolog\Handler\ConsoleHandler; use Symfony\Component\Console\Command\Command; @@ -35,6 +36,11 @@ class ServerLogCommand extends Command return false; } + // based on a symfony/symfony package, it crashes due a missing FormatterInterface from monolog/monolog + if (!class_exists(FormatterInterface::class)) { + return false; + } + return parent::isEnabled(); } diff --git a/src/Symfony/Bundle/WebServerBundle/composer.json b/src/Symfony/Bundle/WebServerBundle/composer.json index d1c64e970f..c48607bca4 100644 --- a/src/Symfony/Bundle/WebServerBundle/composer.json +++ b/src/Symfony/Bundle/WebServerBundle/composer.json @@ -30,6 +30,10 @@ "conflict": { "symfony/dependency-injection": "<3.3" }, + "suggest": { + "symfony/monolog-bridge": "For using the log server.", + "symfony/expression-language": "For using the filter option of the log server." + }, "minimum-stability": "dev", "extra": { "branch-alias": { From dfef227837c79c0ca08af173eb72fec2d1c1e312 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Mon, 13 Nov 2017 17:01:41 +0100 Subject: [PATCH 3/5] Fixed exit code with non-integer throwable code --- src/Symfony/Component/Console/Event/ConsoleErrorEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php index 49edb723d2..a212a3c287 100644 --- a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php +++ b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php @@ -78,6 +78,6 @@ final class ConsoleErrorEvent extends ConsoleEvent */ public function getExitCode() { - return null !== $this->exitCode ? $this->exitCode : ($this->error->getCode() ?: 1); + return null !== $this->exitCode ? $this->exitCode : (is_int($this->error->getCode()) ? $this->error->getCode() : 1); } } From fea815b2f5256f285c39398d4af8582d8c5aaa7b Mon Sep 17 00:00:00 2001 From: Bjorn Twachtmann Date: Tue, 17 Oct 2017 15:38:11 +0100 Subject: [PATCH 4/5] [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files --- .../Component/Translation/MessageSelector.php | 12 +++++++++--- .../Translation/Tests/MessageSelectorTest.php | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Translation/MessageSelector.php b/src/Symfony/Component/Translation/MessageSelector.php index c6134191bc..31304cd0d8 100644 --- a/src/Symfony/Component/Translation/MessageSelector.php +++ b/src/Symfony/Component/Translation/MessageSelector.php @@ -49,10 +49,16 @@ class MessageSelector */ public function choose($message, $number, $locale) { - preg_match_all('/(?:\|\||[^\|])++/', $message, $parts); + $parts = array(); + if (preg_match('/^\|++$/', $message)) { + $parts = explode('|', $message); + } elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) { + $parts = $matches[0]; + } + $explicitRules = array(); $standardRules = array(); - foreach ($parts[0] as $part) { + foreach ($parts as $part) { $part = trim(str_replace('||', '|', $part)); if (preg_match('/^(?P'.Interval::getIntervalRegexp().')\s*(?P.*?)$/xs', $part, $matches)) { @@ -76,7 +82,7 @@ class MessageSelector if (!isset($standardRules[$position])) { // when there's exactly one rule given, and that rule is a standard // rule, use this rule - if (1 === count($parts[0]) && isset($standardRules[0])) { + if (1 === count($parts) && isset($standardRules[0])) { return $standardRules[0]; } diff --git a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php index a9b92c5cee..42b7e0a3fa 100644 --- a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php +++ b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php @@ -128,6 +128,10 @@ class MessageSelectorTest extends TestCase array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1), // esacape pipe array('This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0), + // Empty plural set (2 plural forms) from a .PO file + array('', '|', 1), + // Empty plural set (3 plural forms) from a .PO file + array('', '||', 1), ); } } From fb52f9472214918d61a8ad88dddec638c9e66d47 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 12 Dec 2017 09:25:42 +0100 Subject: [PATCH 5/5] fix merge --- .../Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt index 2a9bcf9b0a..bd7b644dc3 100644 --- a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -33,7 +33,7 @@ array(1) { [0]=> string(37) "Error and exception handlers do match" } -object(Symfony\Component\Debug\Exception\FatalErrorException)#4 (8) { +object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) { ["message":protected]=> string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)" %a