Home > Software design >  Upgrading to Symfony 6 from 5.3
Upgrading to Symfony 6 from 5.3

Time:02-11

I updated my composer.json file to reflect the 6.0.* changes, and ran my composer update "symfony/*" code, and it returned this:

    Problem 1
    - doctrine/doctrine-bundle is locked to version 2.4.3 and an update of this package was not requested.
    - doctrine/doctrine-bundle 2.4.3 requires symfony/config ^4.4.3|^5.0|^6.0 -> found symfony/config[v4.4.3, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - sensio/framework-extra-bundle is locked to version v5.6.1 and an update of this package was not requested.
    - sensio/framework-extra-bundle v5.6.1 requires symfony/config ^4.4|^5.0 -> found symfony/config[v4.4.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 3
    - Root composer.json requires symfony/security-http 6.0.* -> satisfiable by symfony/security-http[v6.0.0-BETA1, ..., 6.0.x-dev].
    - symfony/security-http[v6.0.0-BETA1, ..., 6.0.x-dev] require symfony/http-kernel ^5.4|^6.0 -> found symfony/http-kernel[v5.4.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 4
    - symfonycasts/reset-password-bundle is locked to version v1.10.0 and an update of this package was not requested.
    - symfonycasts/reset-password-bundle v1.10.0 requires symfony/config ^4.4 | ^5.0 | ^6.0 -> found symfony/config[v4.4.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 5
    - symfonycasts/verify-email-bundle is locked to version v1.6.0 and an update of this package was not requested.
    - symfonycasts/verify-email-bundle v1.6.0 requires symfony/config ^4.4 | ^5.0 | ^6.0 -> found symfony/config[v4.4.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 6
    - doctrine/doctrine-fixtures-bundle is locked to version 3.4.1 and an update of this package was not requested.
    - doctrine/doctrine-fixtures-bundle 3.4.1 requires symfony/config ^3.4|^4.3|^5.0|^6.0 -> found symfony/config[v3.4.0-BETA1, ..., 3.4.x-dev, v4.3.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 7
    - doctrine/doctrine-bundle 2.4.3 requires symfony/config ^4.4.3|^5.0|^6.0 -> found symfony/config[v4.4.3, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but these were not loaded, likely because it conflicts with another require.
    - doctrine/doctrine-migrations-bundle 3.2.1 requires doctrine/doctrine-bundle ~1.0|~2.0 -> satisfiable by doctrine/doctrine-bundle[2.4.3].
    - doctrine/doctrine-migrations-bundle is locked to version 3.2.1 and an update of this package was not requested.

Some of these notifications confuse me because I'm not sure what to do when a package is locked a version.

Here is my composer.json file:

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.1",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.3",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.8",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^5.1",
        "stripe/stripe-php": "^7.76",
        "symfony/asset": "6.0.*",
        "symfony/console": "6.0.*",
        "symfony/dotenv": "6.0.*",
        "symfony/expression-language": "6.0.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "6.0.*",
        "symfony/framework-bundle": "5.3.*",
        "symfony/http-client": "6.0.*",
        "symfony/intl": "6.0.*",
        "symfony/mailer": "6.0.*",
        "symfony/mime": "6.0.*",
        "symfony/monolog-bundle": "^3.7",
        "symfony/notifier": "6.0.*",
        "symfony/postmark-mailer": "6.0.*",
        "symfony/process": "6.0.*",
        "symfony/property-access": "6.0.*",
        "symfony/property-info": "6.0.*",
        "symfony/proxy-manager-bridge": "6.0.*",
        "symfony/rate-limiter": "6.0.*",
        "symfony/security-bundle": "6.0.*",
        "symfony/security-core": "6.0.*",
        "symfony/security-csrf": "6.0.*",
        "symfony/security-guard": "5.3.*",
        "symfony/security-http": "6.0.*",
        "symfony/serializer": "6.0.*",
        "symfony/string": "6.0.*",
        "symfony/translation": "6.0.*",
        "symfony/twig-bundle": "^5.3",
        "symfony/validator": "6.0.*",
        "symfony/web-link": "6.0.*",
        "symfony/webpack-encore-bundle": "^1.11",
        "symfony/yaml": "6.0.*",
        "symfonycasts/reset-password-bundle": "^1.7",
        "symfonycasts/verify-email-bundle": "^1.3",
        "taxjar/taxjar-php": "^1.10",
        "twig/cssinliner-extra": "^3.3",
        "twig/extra-bundle": "^3.3",
        "twig/inky-extra": "^3.3",
        "twig/intl-extra": "^3.3",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4",
        "symfony/browser-kit": "^5.3",
        "symfony/css-selector": "^5.3",
        "symfony/debug-bundle": "^5.3",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^5.3",
        "symfony/stopwatch": "^5.3",
        "symfony/var-dumper": "^5.3",
        "symfony/web-profiler-bundle": "^5.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "6.0.*"
        }
    }
}

How do I resolve these problems and also what can I do moving forward so I can be more aware of how to fix these on my own?

CodePudding user response:

That composer.json file is a bit of a mess. Some Symfony packages on 5.3, some even on 5.1, and many on 6.

Also you are controlling Symfony versioning from extra.symfony.require, and at the same time from the discrete version constraints. You include some packages that no longer exist on 6.0 (symfony/security-guard), and are missing some that should be installed on a 6.0 version.

It's simply not on an installable state.

I've managed to make it installable changing it like this:

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.1",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.3",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.8",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^6.0.0",
        "stripe/stripe-php": "^7.76",
        "symfony/asset": "*",
        "symfony/console": "*",
        "symfony/dotenv": "*",
        "symfony/expression-language": "*",
        "symfony/flex": "v2.1.4",
        "symfony/form": "*",
        "symfony/framework-bundle": "*",
        "symfony/http-client": "*",
        "symfony/intl": "*",
        "symfony/mailer": "*",
        "symfony/mime": "*",
        "symfony/monolog-bundle": "^3.7",
        "symfony/notifier": "*",
        "symfony/postmark-mailer": "*",
        "symfony/process": "*",
        "symfony/property-access": "*",
        "symfony/property-info": "*",
        "symfony/proxy-manager-bridge": "*",
        "symfony/rate-limiter": "*",
        "symfony/runtime": "*",
        "symfony/security-bundle": "*",
        "symfony/security-core": "*",
        "symfony/security-csrf": "*",
        "symfony/security-http": "*",
        "symfony/serializer": "*",
        "symfony/string": "*",
        "symfony/translation": "*",
        "symfony/twig-bundle": "*",
        "symfony/validator": "*",
        "symfony/web-link": "*",
        "symfony/webpack-encore-bundle": "^1.11",
        "symfony/yaml": "*",
        "symfonycasts/reset-password-bundle": "^1.7",
        "symfonycasts/verify-email-bundle": "^1.3",
        "taxjar/taxjar-php": "^1.10",
        "twig/cssinliner-extra": "^3.3",
        "twig/extra-bundle": "^3.3",
        "twig/inky-extra": "^3.3",
        "twig/intl-extra": "^3.3",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4",
        "symfony/browser-kit": "*",
        "symfony/css-selector": "*",
        "symfony/debug-bundle": "*",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "*",
        "symfony/stopwatch": "*",
        "symfony/var-dumper": "*",
        "symfony/web-profiler-bundle": "*"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true,
            "composer/package-versions-deprecated": false,
            "symfony/runtime": true
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "6.0.*",
            "docker": true
        }
    }
}

Since this will not match your locked versions, I would simply delete your vendor directory and your composer.lock and run composer install. You'll have to deal with all the different changes from the new recipes, but hopefully this is version-controlled project so it's a matter of going through the changes and see where what issues arise.

It's going to be fun.

  • Related