symfonycomposer-phpsymfony4symfony-flex

Upgrading Symfony 3.4 to 4.x with Flex - Composer Problems


I have a Symfony 3.4 project I'm trying to upgrade to 4.x with Flex but I'm falling at the first hurdle.

With the output of Composer this verbose I assume the answer is staring me straight in the face, but I'm not seeing it. What do I need to do? I've deleted everything in vendor, deleted my composer.lock file, cleared composer cache, etc.

composer.json

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "sensio/framework-extra-bundle": "^5.5",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/flex": "^1.3.1",
        "symfony/framework-bundle": "4.4.*",
        "symfony/monolog-bundle": "^3.5",
        "symfony/orm-pack": "^1.0",
        "symfony/profiler-pack": "^1.0",
        "symfony/twig-pack": "^1.0",
        "symfony/yaml": "4.4.*",
        "friendsofsymfony/jsrouting-bundle": "^2.5",
        "friendsofsymfony/user-bundle": "~2.0",
        "stof/doctrine-extensions-bundle": "^1.3",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "ext-json": "*"
    },
    "require-dev": {
        "symfony/debug-pack": "^1.0",
        "phpstan/extension-installer": "^1.0",
        "phpstan/phpstan": "^0.12.19",
        "phpstan/phpstan-doctrine": "^0.12.10",
        "phpunit/phpunit": "^7.5",
        "symfony/phpunit-bridge": "^3.0"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.4.*"
        }
    }
}

Tried to composer install with:

php -d memory_limit=-1 /usr/local/bin/composer install

And it spews all this out (too big to paste here): https://pastebin.com/KLVRkYdF

Saw something elsewhere about needing to install Flex on its own first, so I tried this:

php -d memory_limit=-1 /usr/local/bin/composer update symfony/flex --no-plugins --no-scripts

But got the following error (too big to paste here): https://pastebin.com/KxG2siZi


Solution

  • The problem is that you haven't updated symfony/swiftmailer-bundle - as given in the composer.json, you tried to install at most v2.6.7 which requires symfony/http-kernelin v2.7 or v3.x. This is not compatible with symfony/framework-bundle in v4.4, as this requires symfony/http-kernel to be of that same v4.4 branch.

    Conclusion: also update symfony/swiftmailer-bundle to at least v3.1 which is the first one to be compatible with Symfony v4.