View Issue Details

IDProjectCategoryView StatusLast Update
0007120OXID eShop (all versions)2.3. Extensions (modules, themes)public2022-03-25 08:10
Reporterivoba 
PriorityurgentSeverityblockReproducibilityalways
Status closedResolutionunable to reproduce 
Product Version6.2.0 
Target VersionFixed in Version 
Summary0007120: Custom Module Command breaks composer update
DescriptionThis is related to https://bugs.oxid-esales.com/view.php?id=7112

When creating your own command inside of a module, composer update fails with

PHP Fatal error: Uncaught Error: Call to undefined method MyName\Importer\Commands\MyCommand::getDefaultName() in /var/www/html/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php:61

This happens only when in service.yaml command in tags is not defined:
So this works:
    tags:
      - { name: 'console.command', command: 'my-name:my-module:my-command' }

But this should work without having to define command again, double to inside of Command class.

->setName('my-name:my-module:my-command')

Seems this is some symfony/console version mismatch with composer.
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

QA

2020-04-17 12:50

administrator   ~0013187

Thanks for your report. This issue was known from the update component. Looks like it triggers also in your mentioned case. I acknowledge it as a bug, but want to say, that it does not block from using the module/command. The error message will be displayed during composer update, but the whole process works anyway.

[sp]

QA

2020-04-27 12:39

administrator   ~0013201

Last edited: 2020-04-27 12:48

View 2 revisions

I have to correct my note. Looks like we were lucky with the update component, but the error itself leads to a execution stop of the process. Therefore script won't be run and for example modules don't get copied or the module configuration won't be updated. This results in major issues.

Priority increased.

Please use the provided workaround: Adding the command to the services.yaml.

[sp]

alfredbez

2020-09-03 11:39

reporter   ~0013286

I stumbled upon the same issue a few months ago, here's the reason: https://stackoverflow.com/a/61655652/2123108

MarcelOxid

2022-03-14 14:18

developer   ~0013792

Thank you for the report again! I was not able to reproduce the described issue. Could you please double-check if the issue is still in place, and if it is:
* please try updating the composer to the latest version and try again
* if still reproducible - could you please provide more information - the Shop/Compilation, php and composer-version you facing the issue on.

QA

2022-03-15 13:07

administrator   ~0013798

QA also tried to reproduce again and were not able to do so.

Tested with:
- 6.4.1 + Composer 2
- 6.3.1 + Composer 2
- 6.3.1 + Composer 1 (this combination is actually not supported!)
- 6.2.5 + Composer 2
- 6.2.4 + Composer 1

Used a simple OXID eShop Component without any extra entry about the command name in the services.yaml. The component adds an example console command. No issues encountered during installation, usage or uninstallation. Last test with OXID eShop 6.2.4 and Composer 1 also provides an (unexpected) positive result. Therefore any other requirement must be given to run into the error or the issue was fixed on a patch release of 6.2 back in the days.

Further instructions needed to reproduce in 6.4.x/6.3.1 with Composer 2. Any other version is outdated and not part of the maintenance process anymore. If reproduceability is not given in these versions, the issue should be closed.

[sp]