Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating symfony/console causing setup:di:compile failure #33595

Closed
5 tasks
Skyfly2021 opened this issue Jul 27, 2021 · 25 comments · Fixed by #34138
Closed
5 tasks

Updating symfony/console causing setup:di:compile failure #33595

Skyfly2021 opened this issue Jul 27, 2021 · 25 comments · Fixed by #34138
Assignees
Labels
Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P0 This generally occurs in cases when the entire functionality is blocked. Progress: done Reported on 2.3.x Indicates original Magento version for the Issue report. Reported on 2.4.2-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S0 A problem that is blocking the ability to work. An immediate fix is needed.

Comments

@Skyfly2021
Copy link

Skyfly2021 commented Jul 27, 2021

Preconditions (*)

1.2.4.2-p1
2.Centos 8
3.php 7.4

Steps to reproduce (*)

Expected result (*)

  1. [Screenshots, logs or description]

Actual result (*)

  1. [Screenshots, logs or description]
    2.Incompatible argument type: Required type: int. Actual type: string
    The name of the upgrade package is not remembered
    The following error occurred during compilation
    image

Workaround

The symfony/console released version 4.4.29 as a hotfix for Magento issue.
For now, you can run composer update symfony/console

Note: the root cause of this issue still not resolved yet


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Jul 27, 2021

Hi @Skyfly2021. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@cha80
Copy link

cha80 commented Jul 27, 2021

image
i am also face this problem 2.3.5-p2

@cha80
Copy link

cha80 commented Jul 27, 2021

it
might update some module case this problem

@Skyfly2021
Copy link
Author

Please downgrade the package, finally solved:
1.composer require symfony/process:4.4.26
2.composer require symfony/console:4.4.26

@brosenberger
Copy link
Contributor

brosenberger commented Jul 27, 2021

i created a pull request for symfony/console: symfony/symfony#42281 and also any 2.3.x magento2 version is affected.

the problem are the missing php-doc parameters which are checked by the magento2 compiler

@cengizcoskun
Copy link

+1

@hostep
Copy link
Contributor

hostep commented Jul 27, 2021

Thanks @brosenberger & @Skyfly2021!

@Skyfly2021: I don't have issues with symfony/process, only with symfony/console

It would be great if Magento's setup:di:compile process could look at the actual argument types and only falls back to the ones in phpdoc when the argument doesn't have a type specified.

Issue will happen for Magento 2.3.5 and higher versions (Magento 2.3.4 restricted symfony/console to max version 4.1.9999)

@kassner
Copy link
Contributor

kassner commented Jul 27, 2021

If you want to patch the issue instead of pinning symfony/console's version:

--- vendor/symfony/console/Input/InputOption.php
+++ vendor/symfony/console/Input/InputOption.php
@@ -48,6 +48,7 @@
     private $description;
 
     /**
+     * @param string $name
      * @param string|array|null                $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
      * @param int|null                         $mode     The option mode: One of the VALUE_* constants
      * @param string|bool|int|float|array|null $default  The default value (must be null for self::VALUE_NONE)

@mortenbirkelund
Copy link

mortenbirkelund commented Jul 27, 2021

Ran into this aswell. Luckily it is a minor patch to add, but hopefully it will be corrected in Symfony.

@mrtuvn mrtuvn added Reported on 2.3.x Indicates original Magento version for the Issue report. Reported on 2.4.2-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Jul 27, 2021
@ihor-sviziev ihor-sviziev added the Severity: S0 A problem that is blocking the ability to work. An immediate fix is needed. label Jul 27, 2021
@sidolov sidolov added the Priority: P0 This generally occurs in cases when the entire functionality is blocked. label Jul 27, 2021
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Jul 27, 2021
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Jul 27, 2021
@thomas-kl1
Copy link
Member

It's not a symfony issue, it's Magento not being smart enough to resolve types correctly :)

Workaround:
"conflict": {
"symfony/console": ">=v5.3.4||>=v4.4.27"
},

@hostep
Copy link
Contributor

hostep commented Jul 27, 2021

I don't think that not allowing versions higher then or equal to 4.4.27 to be installed is the correct workaround. You tend to forget about these workarounds and if symfony then releases a newer version that fixes a security issue, you'll not get it.

It's probably better to only conflict with version 4.4.27 and still allow higher versions. And then if it turns out that the next version still has the same problem, add that version to the conflict range.

It looks like they are considering reverting the change in the next version v4.4 of symfony/console (which should be version 4.4.28 4.4.29)

@thomas-kl1
Copy link
Member

thomas-kl1 commented Jul 27, 2021

@hostep workaround is temporary fix, also the issue is not on the Symfony side, but Magento, as it was for the "Laminas issue" :)
I always encourage to update to the latest version of trusted packages such as laminas or Symfony, because they are well tested, mature and robust. Most of the time when there is an issue with a third party package upgrade, it's because Magento codebase is poorly implemented. Magento has an important debt that won't be fix because they know that "community" will find workaround or will fix it for them. Maybe we should let Magento assume their debt and pay for it?

@viktym
Copy link
Contributor

viktym commented Jul 27, 2021

"conflict": {
    "symfony/console": "4.4.27 || 4.4.28"
  },

The changes will be reverted in symfony/console:4.4.29

@neha023
Copy link

neha023 commented Jul 28, 2021

There is a pull request for symfony/console. This will fix that issue.

symfony/console#75

@fredden
Copy link
Member

fredden commented Jul 28, 2021

This will fix that issue.

The issue exists within Magento. The change made in symfony/console is a temporary work-around and not a fix.

@thomas-kl1
Copy link
Member

This will fix that issue.

The issue exists within Magento. The change made in symfony/console is a temporary work-around and not a fix.

Thank you

@alainstout
Copy link

Please downgrade the package, finally solved:
1.composer require symfony/process:4.4.26
2.composer require symfony/console:4.4.26

THIS: 2.composer require symfony/console:4.4.26 did the trick for me

Thank you!

@sidolov sidolov added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Jul 28, 2021
@barryvdh
Copy link
Contributor

There is fix for the 4.4 version in Symfony/console, which isn't tagged yet. See symfony/symfony#42281 (comment) for details.
Can you try that dev version to confirm no more changes are required?

This should still be fixed for the long term though.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jul 29, 2021

Hi,

I just did a short investigation - it looks like this issue is coming from the Laminas Code component.
Magento tries to detect type for constructor argument in the


while $parameter->detectType() is following:
https://github.com/laminas/laminas-code/blob/3.4.1/src/Reflection/ParameterReflection.php#L77-L113

For the shortcut argument on the \Symfony\Component\Console\Input\InputOption::__construct, it detects type - int (by @param tags position index, not by param name)

And, in the latest laminas-code, this issue isn't resolved yet as well.
https://github.com/laminas/laminas-code/blob/17fd2af36804f3f61788573cb70196454d6ee1d8/src/Reflection/ParameterReflection.php#L71-L102

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jul 29, 2021

Note: symfony/console has released a new version 4.4.29 as a hotfix for Magento where were resolved this issue.
symfony/console@v4.4.27...v4.4.29

Now you can run composer update symfony/console. I added this workaround to the issue description.

Note: this is not a permanent fix, we still should fix the root cause of this.

@ihor-sviziev ihor-sviziev changed the title 2021-07-27Composer update Incompatible argument type: Required type: int. Actual type: string Updating symfony/console causing setup:di:compile failure Jul 29, 2021
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jul 29, 2021

FYI I prepared PR to the laminas-code to fix the listed issue.
laminas/laminas-code#95
Waiting for a feedback

@ihor-sviziev ihor-sviziev self-assigned this Jul 29, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2021

Hi @ihor-sviziev. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Jul 29, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Aug 3, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Aug 3, 2021
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Sep 21, 2021

Finally, the PR laminas/laminas-code#95 that fixes incorrect return type detecting was just merged and released in https://github.com/laminas/laminas-code/releases/tag/4.4.3!
I'm going to prepare a new PR that will update the dependency for Laminas/code

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Ready for Development in High Priority Backlog Sep 23, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Ready for Development in High Priority Backlog Sep 23, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Sep 27, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Sep 27, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P0 This generally occurs in cases when the entire functionality is blocked. Progress: done Reported on 2.3.x Indicates original Magento version for the Issue report. Reported on 2.4.2-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S0 A problem that is blocking the ability to work. An immediate fix is needed.
Projects
Development

Successfully merging a pull request may close this issue.