magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.46k stars 9.28k forks source link

Upgrade to version 2.4.7 gives symfony/process errors #39113

Open dandrikop opened 2 weeks ago

dandrikop commented 2 weeks ago

Preconditions and environment

I had successfully upgraded my Magento installation in the past, and now I have 2.4.6-p7. I tried to upgrade it to version 2.4.7-p2, and I got an error associated with symfony/process module.

Steps to reproduce

When I executed the command composer update --no-dev --dry-run, I got the below error associated with symfony/process module:

Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1 - symfony/process[v4.4.0, ..., v4.4.10] require php ^7.1.3 -> your php version (8.2.22) does not satisfy that requirement. - magento/magento2-functional-testing-framework[3.10.0, ..., 3.12.0] require symfony/process ^4.4||^5.4 -> satisfiable by symfony/process[v4.4.0, ..., v4.4.44, v5.4.0, ..., v5.4.40]. - magento/magento2-functional-testing-framework[3.7.0, ..., 3.9.0] require symfony/process ^4.4 -> satisfiable by symfony/process[v4.4.0, ..., v4.4.44]. - You can only install one version of a package, so only one of these can be installed: symfony/process[2.0.4, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.44, v5.0.0, ..., v5.4.40, v6.0.0, ..., v6.4.8, v7.0.0, ..., v7.1.3]. - magento/product-community-edition 2.4.7-p2 requires symfony/process ^6.4 -> satisfiable by symfony/process[v6.4.0, ..., v6.4.8]. - magento/magento2-functional-testing-framework[3.0.0, ..., 3.6.1] require php ^7.3 -> your php version (8.2.22) does not satisfy that requirement. - Root composer.json requires magento/product-community-edition 2.4.7-p2 -> satisfiable by magento/product-community-edition[2.4.7-p2]. - Root composer.json requires magento/magento2-functional-testing-framework ^3.0 -> satisfiable by magento/magento2-functional-testing-framework[3.0.0, ..., 3.12.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.

I also tried the command composer update --no-dev --with-all-dependencies --dry-run, but the result was the same. I used the command composer show and found the following modules and versions of my Magento 2.4.6-p7:

symfony/process: v5.4.40 magento/magento2-functional-testing-framework: v3.12.0

Expected result

The upgrade is successful.

Actual result

The upgrade failed. It seems that Magento 2.4.7 requires the version 6.4 of the module symfony/process. However, the upgrade of the module symfony/process to version 6.4 cannot be done as the current version 5.4.40 requires PHP 7.2.5 while, according to the documentation, Magento 2.4.7 requires at least PHP 8.1 and this for the upgrade process only.

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 weeks ago

Hi @dandrikop. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

hostep commented 2 weeks ago

Make sure to take over the changes done to the composer.json file from core magento, the diff between 2.4.6-p7 and 2.4.7-p2 is this:

--- magento246-p7-test/composer.json    2024-08-06 05:26:14
+++ magento247-p2-test/composer.json    2024-08-06 06:25:30
@@ -16,11 +16,11 @@
         "preferred-install": "dist",
         "sort-packages": true
     },
-    "version": "2.4.6-p7",
+    "version": "2.4.7-p2",
     "require": {
-        "magento/product-community-edition": "2.4.6-p7",
-        "magento/composer-root-update-plugin": "~2.0",
-        "magento/composer-dependency-version-audit-plugin": "~0.1"
+        "magento/product-community-edition": "2.4.7-p2",
+        "magento/composer-dependency-version-audit-plugin": "~0.1",
+        "magento/composer-root-update-plugin": "^2.0.4"
     },
     "autoload": {
         "exclude-from-classmap": [
@@ -38,27 +38,23 @@
             ]
         },
         "psr-4": {
-            "Magento\\": "app/code/Magento/",
-            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
             "Magento\\Setup\\": "setup/src/Magento/Setup/"
         }
     },
     "require-dev": {
         "allure-framework/allure-phpunit": "^2",
-        "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
+        "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.0",
         "dg/bypass-finals": "^1.4",
-        "friendsofphp/php-cs-fixer": "^3.8",
+        "friendsofphp/php-cs-fixer": "^3.22",
         "lusitanian/oauth": "^0.8",
         "magento/magento-coding-standard": "*",
-        "magento/magento2-functional-testing-framework": "^4.3.1",
+        "magento/magento2-functional-testing-framework": "^4.7",
         "pdepend/pdepend": "^2.10",
         "phpmd/phpmd": "^2.12",
         "phpstan/phpstan": "^1.9",
         "phpunit/phpunit": "^9.5",
-        "sebastian/comparator": "<=4.0.6",
         "sebastian/phpcpd": "^6.0",
-        "symfony/finder": "^5.4",
-        "symfony/process": "<=v5.4.23"
+        "symfony/finder": "^6.4"
     },
     "conflict": {
         "gene/bluefoot": "*"

In your case, the problem is likely that requirement on symfony/finder that needs to be updated or symfony/process requirement that should be removed. And the fact that the version of magento/magento2-functional-testing-framework is really old. But I would highly recommend to take over all the changes.

Each time you update Magento, I would suggest executing these steps in an empty directory to double check the changes in composer.json file:

# replace the exact versions in the commands below, and make sure you have your authentication keys at hand
$ composer create-project --no-install --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.6-p7 ./old-version
$ composer create-project --no-install --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.7-p2 ./new-version
$ diff -u old-version/composer.json new-version/composer.json
dandrikop commented 2 weeks ago

@hostep Thanks for your feedback. I followed your advice, and I worked only with the section "require-dev" of my composer.json file; i.e. I didn't touch any other section of the file. Specifically, at the section "require-dev" I made one-by-one the changes below till the command composer update --no-dev --dry-run was finally successful:

However, comparing the section "require-dev" of my composer.json file with the one of Magento 2.4.7-p2, I still find differences like the following:

Should I also include those changes at the section "require-dev" of my composer.json file, no matter that the command composer update --no-dev --dry-run was successful?

hostep commented 2 weeks ago

You are free to do with the composer.json like you want, you are the owner of that file. See the default one Magento creates as a base and as something you can build further upon.

But my advise would be to stay as close as possible to the default version, because the list of those packages is how Magento has been tested.