简体   繁体   中英

Error after upgrading to Symfony 5.3 and updading flex recipes (symfony:recipes:install --force)

Trying to perform a "minor" version upgrade (5.2 to 5.3) on a fresh/clean symfony 5.2 project (ie 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

屏幕

You should install the symfony/runtime component.

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

在此处输入图片说明

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM