-1

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

BT643
  • 3,495
  • 5
  • 34
  • 55
  • 2
    Upgrading major versions can be tricky. Consider creating a new 4.4 project, install your third party bundles and use the resulting composer.json file as a starting point. – Cerad May 03 '20 at 22:50

2 Answers2

3

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.

Nico Haase
  • 11,420
  • 35
  • 43
  • 69
  • Thanks, this was the problem :) I think it might be cleaner for me to start a fresh project and move things across though as some others have suggested. – BT643 May 04 '20 at 13:56
-1

I also had a lot of issues with composer, packageversions and memory limits in the past.

Package vesions: Set all symfony packages to the version "*" if yout dont require a specific Version at this point. Thisway composer will select the one suitable to your configured symfony version.

Memory limit: Which IDE are you using? Which PHP Version? 32 or 64 bit? Try running the commany outside of the IDE and see what happens. Alternatively try the symfony command.

Will I
  • 1
  • 1
  • I'm not having any problems with memory limits :) I just added that to the start of the composer command to allow it to use as much memory as it needed. – BT643 May 04 '20 at 13:33