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

Fix event dispatch error on Drupal 9.0 #3592

Closed
clayliddell opened this issue Jul 28, 2021 · 4 comments
Closed

Fix event dispatch error on Drupal 9.0 #3592

clayliddell opened this issue Jul 28, 2021 · 4 comments
Assignees
Labels

Comments

@clayliddell
Copy link
Contributor

Describe the bug

Whenever I create a new dataset on a Drupal 9.0 site running DKAN, I receive a vague whitepage error, and the following is logged to watchdog:

TypeError: Argument 2 passed to Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch() must be an instance of Symfony\Component\EventDispatcher\Event or null, string given, called in /var/www/dkan/modules/common/src/EventDispatcherTrait.php on line 40 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 89 of /var/www/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php) #0 /var/www/dkan/modules/common/src/EventDispatcherTrait.php(40): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\common\Events\Event), 'dkan_common_tab...')
#1 /var/www/dkan/modules/common/src/Storage/AbstractDatabaseTable.php(286): Drupal\common\Storage\AbstractDatabaseTable->dispatchEvent('dkan_common_tab...', Array)
#2 /var/www/dkan/modules/common/src/Storage/AbstractDatabaseTable.php(254): Drupal\common\Storage\AbstractDatabaseTable->tableCreate('harvest_sample_...', Array)
#3 /var/www/dkan/modules/common/src/Storage/AbstractDatabaseTable.php(67): Drupal\common\Storage\AbstractDatabaseTable->setTable()
#4 /var/www/dkan/modules/harvest/src/Storage/DatabaseTable.php(34): Drupal\common\Storage\AbstractDatabaseTable->retrieve('cedcd327-4e5d-4...')
#5 /var/www/vendor/getdkan/harvest/src/ETL/Load/Load.php(52): Drupal\harvest\Storage\DatabaseTable->retrieve('cedcd327-4e5d-4...')
#6 /var/www/vendor/getdkan/harvest/src/ETL/Load/Load.php(32): Harvest\ETL\Load\Load->itemState(Object(stdClass))
#7 /var/www/vendor/getdkan/harvest/src/Harvester.php(137): Harvest\ETL\Load\Load->run(Object(stdClass))
#8 /var/www/vendor/getdkan/harvest/src/Harvester.php(96): Harvest\Harvester->load(Object(stdClass))
#9 /var/www/dkan/modules/sample_content/src/Drush.php(23): Harvest\Harvester->harvest()
#10 [internal function]: Drupal\sample_content\Drush->create(Array)
#11 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#12 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#14 /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#15 /var/www/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/vendor/symfony/console/Application.php(1018): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#22 /var/www/vendor/drush/drush/drush(4): require('/var/www/vendor...')
#23 {main}

The above behavior was not exhibited on Drupal 8.9 or 9.1.

Steps To Reproduce

  1. Create a DKAN dataset with a resource.
  2. Observe the above error in watchdog.

Expected behavior

Creating a dataset on a Drupal 9.0 site should not result in the above error.

@clayliddell clayliddell self-assigned this Jul 28, 2021
@clayliddell clayliddell changed the title Encountering Undefined index: file_url_type... error when navigating the the Edit Dataset form Fix event dispatch error on Drupal 9.0 Jul 29, 2021
@clayliddell
Copy link
Contributor Author

Per discussion with @dafeder, this is pretty low priority since it only affects Drupal 9.0. Drupal 8.9 and 9.1 appear to be unaffected.

@dafeder
Copy link
Member

dafeder commented Jul 29, 2021

This should be affecting 8.9 and 9.0 equally -- both are using the same version of Symfony event dispatching. So even though no one should be using 9.0 anymore (it is marked insecure and not clear there will be a new safe release of 9.0.x) we want to make sure that 8.9 and 9.1+ are both working without issue, and merge this asap.

@clayliddell
Copy link
Contributor Author

@dafeder A fresh instance of DKAN with Drupal 8.9.17 appears to be working fine on my local. The same is true for Drupal 9.1.11. Drupal 9.0.x appears to be broken on DKAN 2.x. All three of these version of Drupal appear to work fine when on the branch associated with the PR I've opened.

@clayliddell clayliddell assigned dafeder and unassigned clayliddell Jul 29, 2021
@dafeder
Copy link
Member

dafeder commented Jul 29, 2021

After giving this some thought, I believe it make sense to retain the simpler logic for determining the correct method signature unless a secure version of 9.0 is release. As is, I don't think we should bring in more complex code that only serves to enable people to continue using an insecure version of core. We'll keep the PR for a while open in case there are any developments upstream, but I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants