3

Trying to perform a "minor" version upgrade (5.2 to 5.3) on a fresh/clean symfony 5.2 project (i.e. composer create-project symfony/website-skeleton:"5.2.*" s5test)

Then i just add a home page for testing purposes (https://symfony.com/doc/current/page_creation.html)

In composer.json: I changed all instances of 5.2.* to 5.3.*: "symfony/...": "5.2." to "symfony/...": "5.3." "symfony/...": "^5.2 to "symfony/...": "^5.3", etc.

I then execute composer update "symfony/*" --with-all-dependencies] which runs ok.

To complete the upgrade I need to update the flex recipes for six packages:

  • symfony/routing
  • symfony/security-bundle
  • symfony/translation

all install ok.

But after installing the symfony/console recipe (composer recipes:install symfony/console --force -v), I try running composer update and the cache:clear part of the update fails with the error:

Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 255 !! Script @auto-scripts was called via post-update-cmd

And after updating the flex recipe for symfony/framework-bundle (composer recipes:install symfony/framework-bundle --force -v) I get an blank page when trying to access the application and nothing at var/log/dev.log

Screen

pok_net
  • 358
  • 3
  • 12
  • Might want to ask over on the [Symfony Reddit](https://www.reddit.com/r/symfony/) board even though I think your question is perfectly valid. A new [runtime component](https://symfony.com/blog/new-in-symfony-5-3-runtime-component) was introduced in 5.3. Completely changes the startup process for both commands and web pages. It should still update cleanly but it's hard to say. Conside just creating a fresh 5.3 project. – Cerad Jul 28 '21 at 13:17
  • @Cerad: thanks for the suggestions! the thing is that this is just a test / preparation before I apply this upgrade to my work project. So i cannot start with a fresh 5.3 project. Will check Symfony Reddit ... – pok_net Jul 28 '21 at 13:29
  • @yivi that the thing. I never had issues in the past with upgrades... but now when I install 2 of the needed recipes things stop working. – pok_net Jul 28 '21 at 13:37
  • @yivi Did you update the recipes? The unusual thing about 5.2 -> 5.3 is that booting process is completely changed. Both public/index.php and bin/console are very very different. If you don't mess with the recipes then things are probably fine. – Cerad Jul 28 '21 at 13:40
  • That is correct. for example console commands stop working after 'composer recipes:install symfony/console --force -v' Before that all are good... – pok_net Jul 28 '21 at 13:44
  • @yivi: i do not install all recipes at once but 1 at a time. and i do describe for example what happens when i install the `symfony/console` recipe. and i do mention the 4 recipes that are installed ok. What info do you thing I am missing? – pok_net Jul 28 '21 at 13:59
  • @PolychronisKampylis With respect to updating your question, you use quite a few words and frankly it is hard to determine exactly what you did and did not do. Consider simplifying it by just listing the exact commands you ran before encountering your problem. And I know you have already rejected this suggestion but you really should consider creating a fresh 5.3 project and then at least diffing the composer.json file. – Cerad Jul 28 '21 at 14:00
  • @Cerad. I added the 2 recipes update update commands. I initially tried to update my main working project. When this failed i tried to simplify things by performing a fresh 5.2 to 5.3 upgrade. When this failed I did try to compare a fresh 5.2 and a fresh 5.3. I also installed and checked a Symfony Demo 5.3 project and tried to diff and find a fix. When i ended up with nothing i posted this question. – pok_net Jul 28 '21 at 14:26
  • @yivi do you have an idea why I did not get the same error message as you? would it be my macos localhost? – pok_net Jul 28 '21 at 15:22

2 Answers2

4

You should install the symfony/runtime component.

After updating the symfony/console flex recipe you should get an error message similar to this:

enter image description here

Which explains what you need to do:

composer require symfony/runtime

Install that component and you should be mostly good to go.

If you encounter additional issues, pay close attention to the error messages.

Additionally, I'd try to run PHP with a more verbose error reporting level while developing/updating, since apparently you are not getting any useful feedback from the application.

yivi
  • 42,438
  • 18
  • 116
  • 138
0

@yivi his answer is great and fixed the main issue. But after I installed composer require symfony/runtime I also had to change public/index.php file.

It used to be this:

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
    umask(0000);

    Debug::enable();
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
    Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
    Request::setTrustedHosts([$trustedHosts]);
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

But is in 5.4 this:

<?php

use App\Kernel;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

It now works all smooth and perfect.

Allart
  • 830
  • 11
  • 33