symfonycomposer-phpshopwareshopware6

Update 6.4 to 6.5: Class "Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle" not found in Kernel while running bin/console


I am getting the following error while updating Shopware 6.4 to 6.5 or 6.6:

PHP Fatal error:  Uncaught Error: Class "Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle" not found in /home/user/projects/shopware/vendor/shopware/core/Kernel.php:111

I have updated composer.json to a 6.5 compatible state. My composer json looks like this:

{
"license": "proprietary",
"type": "project",
"require": {
    "php": "~8.2.0",
    "composer-runtime-api": "^2.0",
    "shopware/administration": "6.5.8.2",
    "shopware/core": "6.5.8.2",
    "shopware/elasticsearch": "6.5.8.2",
    "shopware/storefront": "6.5.8.2",
    "symfony/flex": "~2",
    "symfony/runtime": "^5.0|^6.0"
},
"require-dev": {
    "doctrine/coding-standard": "^12.0",
    "friendsofphp/php-cs-fixer": "^3.48",
    "frosh/development-helper": "^1.0",
    "phpstan/phpstan": "^1.10",
    "phpunit/php-code-coverage": "^10.1",
    "phpunit/phpunit": "^10.5",
    "shopware/dev-tools": "^1.3",
    "symfony/web-profiler-bundle": "^6.4",
    "vimeo/psalm": "^5.20"
},
"repositories": {
    "0": {
        "type": "path",
        "url": "custom/plugins/*",
        "options": {
            "symlink": true
        }
    },
    "1": {
        "type": "path",
        "url": "custom/plugins/*/packages/*",
        "options": {
            "symlink": true
        }
    },
    "2": {
        "type": "path",
        "url": "custom/static-plugins/*",
        "options": {
            "symlink": true
        }
    },
    "shopware-packages": {
        "type": "composer",
        "url": "https://packages.shopware.com"
    }
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
    "allow-plugins": {
        "php-http/discovery": true,
        "symfony/flex": true,
        "symfony/runtime": true,
        "dealerdirect/phpcodesniffer-composer-installer": true
    },
    "optimize-autoloader": true,
    "sort-packages": true
},
"scripts": {
    "auto-scripts": {
        "assets:install": "symfony-cmd"
    },
    "post-install-cmd": [
        "@auto-scripts"
    ],
    "post-update-cmd": [
        "@auto-scripts"
    ]
},
"extra": {
    "symfony": {
        "allow-contrib": true,
        "endpoint": [
            "https://raw.githubusercontent.com/shopware/recipes/flex/main/index.json",
            "flex://defaults"
        ]
    }
}
}

I have also updated bin/console to 6.5 by replacing its contents accordingly.

#!/usr/bin/env php
<?php

use Shopware\Core\Framework\Plugin\KernelPluginLoader\DbalKernelPluginLoader;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\StaticKernelPluginLoader;
use Shopware\Core\HttpKernel;
use Shopware\Core\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;

if (!file_exists(__DIR__ . '/../.env') && !file_exists(__DIR__ . '/../.env.dist') && !file_exists(__DIR__ . '/../.env.local.php')) {
    $_SERVER['APP_RUNTIME_OPTIONS']['disable_dotenv'] = true;
}

require_once __DIR__ . '/../vendor/autoload_runtime.php';

return static function (array &$context) {
    set_time_limit(0);

    $classLoader = require __DIR__ . '/../vendor/autoload.php';

    if (!class_exists(Application::class)) {
        throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
    }

    if (!isset($context['PROJECT_ROOT'])) {
        $context['PROJECT_ROOT'] = dirname(__DIR__);
    }

    $input = new ArgvInput();
    $env = $input->getParameterOption(['--env', '-e'], $context['APP_ENV'] ?? 'prod', true);
    $debug = ($context['APP_DEBUG'] ?? ($env !== 'prod')) && !$input->hasParameterOption('--no-debug', true);

    $pluginLoader = new StaticKernelPluginLoader($classLoader, null);

    if ($input->getFirstArgument() === 'system:install') {
        $context['INSTALL'] = true;
    }

    if (trim($context['DATABASE_URL'] ?? '') === '') {
        // fake DATABASE_URL
        $_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
    } else if (!isset($context['INSTALL'])) {
        $pluginLoader = new DbalKernelPluginLoader($classLoader, null, \Shopware\Core\Kernel::getConnection());
    }

    $kernel = new HttpKernel($env, $debug, $classLoader);
    $kernel->setPluginLoader($pluginLoader);

    $application = new Application($kernel->getKernel());
    $kernel->getKernel()->boot();

    $application->setName('Shopware');
    $application->setVersion($kernel->getKernel()->getContainer()->getParameter('kernel.shopware_version'));

    return $application;
};

I have tried to run composer dump-autoload and deleted var/cache manually, without success. What else can I try?


Solution

  • I fixed this issue by removing all Sensio/ and Enqueue/ Bundles from config/bundles.php