EventDispatcher::dispatch() argument order changed 9.1

Created on 20 October 2023, about 1 year ago

Problem/Motivation

Issue when execute drush ex on a Drupal higher than 9.1, 10.1 in my case.

[2023-10-20T12:00:16.293034+02:00] php.ERROR: TypeError: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch(): Argument #1 ($event) must be of type object, string given, called in /var/www/html/web/modules/contrib/entity_staging/src/EntityStagingExport.php on line 235 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 89 of /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php) #0 /var/www/html/web/modules/contrib/entity_staging/src/EntityStagingExport.php(235): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('entity_staging....', Object(Drupal\entity_staging\Event\EntityStagingBeforeExportEvent)) #1 /var/www/html/web/modules/contrib/entity_staging/src/EntityStagingExport.php(160): Drupal\entity_staging\EntityStagingExport->doExport(Array, 'node', 'article') #2 /var/www/html/web/modules/contrib/entity_staging/src/Commands/EntityStagingCommands.php(58): Drupal\entity_staging\EntityStagingExport->export(NULL, Array) #3 [internal function]: Drupal\entity_staging\Commands\EntityStagingCommands->content(NULL, Array) #4 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array) #5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData)) #6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData)) #7 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData)) #8 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /var/www/html/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 /var/www/html/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array) #15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...') #16 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...') #17 {main}. {"backtrace":[{"line":89,"file":"/var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php"},{"file":"/var/www/html/web/modules/contrib/entity_staging/src/EntityStagingExport.php","line":235,"function":"dispatch","class":"Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher","type":"->","args":["entity_staging.before_export",{"Drupal\\entity_staging\\Event\\EntityStagingBeforeExportEvent":[]}]},{"file":"/var/www/html/web/modules/contrib/entity_staging/src/EntityStagingExport.php","line":160,"function":"doExport","class":"Drupal\\entity_staging\\EntityStagingExport","type":"->","args":[{"default_language":{"node":[{"Drupal\\node\\Entity\\Node":{"in_preview":null}},{"Drupal\\node\\Entity\\Node":{"in_preview":null}},{"Drupal\\node\\Entity\\Node":{"in_preview":null}}]}},"node","article"]},{"file":"/var/www/html/web/modules/contrib/entity_staging/src/Commands/EntityStagingCommands.php","line":58,"function":"export","class":"Drupal\\entity_staging\\EntityStagingExport","type":"->","args":[null,{"merge":0,"druplicon":false,"xh-link":null,"notify":false,"help":false,"quiet":false,"verbose":false,"version":false,"ansi":null,"no-interaction":false,"yes":false,"no":false,"root":"/var/www/html/web","uri":null,"simulate":false,"pipe":false,"define":[]}]},{"function":"content","class":"Drupal\\entity_staging\\Commands\\EntityStagingCommands","type":"->","args":[null,{"merge":0,"druplicon":false,"xh-link":null,"notify":false,"help":false,"quiet":false,"verbose":false,"version":false,"ansi":null,"no-interaction":false,"yes":false,"no":false,"root":"/var/www/html/web","uri":null,"simulate":false,"pipe":false,"define":[]}]},{"file":"/var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php","line":276,"function":"call_user_func_array","args":[[{"Drupal\\entity_staging\\Commands\\EntityStagingCommands":[]},"content"],[null,{"merge":0,"druplicon":false,"xh-link":null,"notify":false,"help":false,"quiet":false,"verbose":false,"version":false,"ansi":null,"no-interaction":false,"yes":false,"no":false,"root":"/var/www/html/web","uri":null,"simulate":false,"pipe":false,"define":[]}]]},{"file":"/var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php","line":212,"function":"runCommandCallback","class":"Consolidation\\AnnotatedCommand\\CommandProcessor","type":"->","args":[[{"Drupal\\entity_staging\\Commands\\EntityStagingCommands":[]},"content"],{"Consolidation\\AnnotatedCommand\\CommandData":[]}]},{"file":"/var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php","line":176,"function":"validateRunAndAlter","class":"Consolidation\\AnnotatedCommand\\CommandProcessor","type":"->","args":[["entity_staging:export","ex","export-content","Drupal\\entity_staging\\Commands\\EntityStagingCommands"],[{"Drupal\\entity_staging\\Commands\\EntityStagingCommands":[]},"content"],{"Consolidation\\AnnotatedCommand\\CommandData":[]}]},{"file":"/var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php","line":391,"function":"process","class":"Consolidation\\AnnotatedCommand\\CommandProcessor","type":"->","args":[{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]},["entity_staging:export","ex","export-content","Drupal\\entity_staging\\Commands\\EntityStagingCommands"],[{"Drupal\\entity_staging\\Commands\\EntityStagingCommands":[]},"content"],{"Consolidation\\AnnotatedCommand\\CommandData":[]}]},{"file":"/var/www/html/vendor/symfony/console/Command/Command.php","line":326,"function":"execute","class":"Consolidation\\AnnotatedCommand\\AnnotatedCommand","type":"->","args":[{"Symfony\\Component\\Console\\Input\\ArgvInput":"ex"},{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]}]},{"file":"/var/www/html/vendor/symfony/console/Application.php","line":1081,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[{"Symfony\\Component\\Console\\Input\\ArgvInput":"ex"},{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]}]},{"file":"/var/www/html/vendor/symfony/console/Application.php","line":320,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"Consolidation\\AnnotatedCommand\\AnnotatedCommand":[]},{"Symfony\\Component\\Console\\Input\\ArgvInput":"ex"},{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]}]},{"file":"/var/www/html/vendor/symfony/console/Application.php","line":174,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"Symfony\\Component\\Console\\Input\\ArgvInput":"ex"},{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]}]},{"file":"/var/www/html/vendor/drush/drush/src/Runtime/Runtime.php","line":124,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[{"Symfony\\Component\\Console\\Input\\ArgvInput":"ex"},{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]}]},{"file":"/var/www/html/vendor/drush/drush/src/Runtime/Runtime.php","line":51,"function":"doRun","class":"Drush\\Runtime\\Runtime","type":"->","args":[["../vendor/bin/drush","ex"],{"Symfony\\Component\\Console\\Output\\ConsoleOutput":[]}]},{"file":"/var/www/html/vendor/drush/drush/drush.php","line":79,"function":"run","class":"Drush\\Runtime\\Runtime","type":"->","args":[["../vendor/bin/drush","ex"]]},{"file":"/var/www/html/vendor/drush/drush/drush","line":4,"args":["/var/www/html/vendor/drush/drush/drush.php"],"function":"require"},{"file":"/var/www/html/vendor/bin/drush","line":119,"args":["/var/www/html/vendor/drush/drush/drush"],"function":"include"}],"exception":"[object] (TypeError(code: 0): Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher::dispatch(): Argument #1 ($event) must be of type object, string given, called in /var/www/html/web/modules/contrib/entity_staging/src/EntityStagingExport.php on line 235 at /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:89)","severity_level":3} {"referer":"","ip":"127.0.0.1","request_uri":"http://default/","uid":0,"user":""}

Proposed resolution

Change record:
https://www.drupal.org/node/3159012

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France goz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024