akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
950 stars 513 forks source link

Commands fail with "An option shortcut cannot be empty." #20393

Open masmrlar opened 5 months ago

masmrlar commented 5 months ago

Several commands contain invalid option configuration code resulting into exceptions starting with symfony/console 5.4.35

Example: https://github.com/akeneo/pim-community-dev/blob/9f31b0515d85b764e98cd77760219f2d1a8a8136/src/Akeneo/Pim/Enrichment/Bundle/Command/CalculateCompletenessCommand.php#L61

Symfony code triggering the error: https://github.com/symfony/console/blame/dbdf6adcb88d5f83790e1efb57ef4074309d3931/Input/InputOption.php#L85C53-L85C88

Thijzer commented 4 months ago

This issue is manifesting in Akeneo editions that depend on Symfony 5.4.* now..

bin/console listings are failing and you can't use the Akeneo Commands where InputOptions are used.

I found this related issue https://github.com/akeneo/pim-community-dev/issues/19430

cypx commented 4 months ago

Same here. As a workaround I lock Symfony Console version intocomposer.json

       "symfony/console": "5.4.34"
ETEML17 commented 4 months ago

Hello @cypx, in which composer.json do you modify or add this line please ?

cypx commented 4 months ago

@ETEML17 this one https://github.com/akeneo/pim-community-standard/blob/v7.0.50/composer.json, it's the one you found at the root of your composer project when you do manual installation ( https://docs.akeneo.com/7.0/install_pim/manual/installation_ce.html ) You could add the line to the require-dev object.

{
    "name": "akeneo/pim-community-standard",
    "description": "The \"Akeneo Community Standard Edition\" distribution",
    "license": "OSL-3.0",
    "type": "project",
    "authors": [
        {
            "name": "Akeneo",
            "homepage": "http://www.akeneo.com"
        }
    ],
    "autoload": {
        "psr-0": {
            "": "src/"
        },
        "psr-4": {
            "Pim\\Upgrade\\": "upgrades/"
        },
        "exclude-from-classmap": [
            "vendor/akeneo/pim-community-dev/src/Kernel.php"
        ]
    },
    "require": {
        "akeneo/pim-community-dev": "^7.0.0"
    },
    "require-dev": {
        "symfony/console": "5.4.34",
        "symfony/debug-bundle": "^5.4.0",
        "symfony/web-profiler-bundle": "^5.4.0"
    },
    "scripts": {
        "post-update-cmd": [
            "vendor/akeneo/pim-community-dev/std-build/install-required-files.sh"
        ],
        "post-install-cmd": [
            "vendor/akeneo/pim-community-dev/std-build/install-required-files.sh"
        ],
        "post-create-project-cmd": [
            "vendor/akeneo/pim-community-dev/std-build/install-required-files.sh"
        ]
    },
    "minimum-stability": "stable",
    "config": {
        "allow-plugins": {
            "symfony/flex": true
        }
    },
    "extra": {
        "symfony": {
            "require": "5.4.*"
        }
    }
}
masmrlar commented 4 months ago

Hi @ETEML17 - in your projects composer.json

Just run composer require "symfony/console:5.4.34"

ETEML17 commented 4 months ago

Thanks for your help @cypx and @masmrlar , for my need i added a task in my playbook with composer require "symfony/console:5.4.34" and it solved the issue :)