I update from 8.4.6 to 8.5.1, when I run drush updb, I get the following error:
Error: Call to a member function getConfigDependencyKey() on null in /home/vagrant/docroot/web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php on line 395 #0
/home/vagrant/docroot/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(47): Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid->calculateDependencies()
#1 [internal function]: Drupal\views\Plugin\views\display\DisplayPluginBase->calculatePluginDependencies(Object(Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid), 4)
#2 /home/vagrant/docroot/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(960): array_walk(Array, Array)
#3 /home/vagrant/docroot/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(47): Drupal\views\Plugin\views\display\DisplayPluginBase->calculateDependencies()
#4 /home/vagrant/docroot/web/core/modules/views/src/Entity/View.php(282):
Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies(Object(Drupal\views\Plugin\views\display\Block))
#5 /home/vagrant/docroot/web/core/modules/views/views.post_update.php(269): Drupal\views\Entity\View->calculateDependencies()
#6 [internal function]: {closure}(Object(Drupal\views\Entity\View), 'filtered_landin...')
#7 /home/vagrant/docroot/web/core/modules/views/views.post_update.php(273): array_walk(Array, Object(Closure))
#8 /home/vagrant/docroot/web/core/includes/update.inc(241): views_post_update_bulk_field_moved(Array)
#9 /usr/local/share/drush/commands/core/drupal/batch.inc(163): update_invoke_post_update('views_post_upda...', Object(DrushBatchContext))
#10 /usr/local/share/drush/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#11 /usr/local/share/drush/includes/batch.inc(98): _drush_batch_command('4453')
#12 /usr/local/share/drush/commands/core/drupal/update.inc(174): drush_batch_command('4453')
#13 /usr/local/share/drush/commands/core/core.drush.inc(1221): _update_batch_command('4453')
#14 /usr/local/share/drush/includes/command.inc(366): drush_core_updatedb_batch_process('4453')
#15 /usr/local/share/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#16 /usr/local/share/drush/includes/command.inc(185): drush_command('4453')
#17 /usr/local/share/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#18 /usr/local/share/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#19 /usr/local/share/drush/drush.php(12): drush_main()
#20 {main}
Error: Call to a member function getConfigDependencyKey() on null in Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid->calculateDependencies() (line 395 of
/home/vagrant/docroot/web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php).
DRUSH_BACKEND_OUTPUT_START>>><<<DRUSH_BACKEND_OUTPUT_END, code: 1)
Comments
Comment #2
juanl commentedI being able to fix this by modify the yml of the view that throw the error. By adding "vids" value to it when a taxonomy is used.
Comment #3
rpataca commentedI'm having the exact same issue when updating from 8.4.6 to 8.5.1.
juanl can you elaborate a bit?
Thanks!
Comment #5
rabithk commentedI am also facing the same issue, for any version upgrade from 8.4.8 to 8.5.0 or higher. @juanl , what did you do to fix this?
This looks like the issue is with the custom views, as when I delete all custom views that work, so it is related to views that use taxonomy.
Comment #6
glelarge commentedHi,
I was facing this same error during a custom module uninstallation.
For my context, the custom module provides a taxonomy created by the file my_module/config/install/taxonomy.vocabulary.myVocabulary.yml .
Terms are created during the module installation in my_module/my_module.install .
With only the custom taxonomy, the custom module uninstallation is successful, and the taxonomy is deleted.
But if a custom view is referring to this custom taxonomy (like mentioned in #5), the module uninstallation is failing due to this issue.
I am working on the 8.7.4, the line raising the issue is 394 instead of 395 in the original description but it is the same.
From my analysis, it is like the module uninstallation first removes the taxonomy then tries to remove the custom views that calculates the deps ==> raise the issue because as explained in the logs,
$vocabularyis null.Adding a check
if (null != $vocabulary), the module is uninstalling successfully.I attached the patch to this comment.
Comment #7
bwoods commentedI ran into this issue upgrading from 8.7 to 8.8. I think I may have hit it due to another patch I had used related to TaxonomyIndexTid - https://www.drupal.org/project/drupal/issues/2429699 . I initially needed this patch for some custom views work, but I had since removed that particular need for my current custom view. Somewhere along the way, I'm thinking something may have not been fully deleted, but fortunately the #6 patch from @glelarge saved the day. Thanks for posting!
Comment #8
damontgomery commentedI had the same issue when updating from 8.7.8 to 8.8.0. I'm not sure exactly what caused it, maybe as I continue with the update.
I've attached a slightly modified patch that uses
!is_null($vocabulary)since I feel like that is the better? way to check for null values. With the patch, we could completedrush updb.I also updated the component to taxonomy.module since that's where the file in question is.
I would re-open this issue, but I don't have the permissions.
This was the problematic update hook we encountered:
views_post_update_limit_operator_defaults, Define default values for limit operators settings in all filters.
Comment #9
glelarge commented@damontgomery
Same for me, that's why I opened the #3068442: Error: Call to a member function getConfigDependencyKey() on null in web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
Comment #10
karimbou commentedSame issue here using Drupal 8.8.10.
Created a view on this version of Drupal, and for some reason after adding simply filters on taxonomy terms, i couldn't save my view having this error even after removing those filter fields.
Comment #11
usdv commentedsmall change for 9.2.7
Comment #12
volker23 commentedThanks a lot for #11, it works on 9.3.0!
Comment #13
daveianoI can confirm, #11 works on 9.3
Comment #14
astringer commentedI ran into this issue upgrading for 9.3.13 to 9.4.2 -- I can confirm #11 works for 9.4.2.
Can someone change this from fixed to open? I don't have permission to do that.
Comment #15
dqdThis issue has been closed for longer inactivity automatically after it has been set to fixed manually in #2, which is actually wrong, since it is not a fix for this issue, but a personal "workaround" and report how it can be fixed. But still, the issue seem to occur, so the user reports. So this is not fixed yet for latest Drupal versions and needs maintainers attention then, correct?
OK - Set "Needs reroll" tag to get the Drupal 9 patch rerolled against latest 10.x and set "Needs a backport to Drupal 9" just in case, but I am not sure if Drupal 9 will have a long enough update support fir this issue, since it depends on S4, which has EOL set for 2023. Apart from that: do we need tests? I will ping taxonomy maintainers in Slack. Regarding https://api.drupal.org/api/drupal/core!MAINTAINERS.txt/9.0.x this would be @xjm and @catch.
I can reproduce this error by simply trying to save a view having exposed term filters added in latest Drupal 9 version running, but with the Error referring to line 427 of core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php now.
Oh and please do not raise priority unnecessarily high. Descriptions of the Priority and Status values can be found in the Drupal project issues documentation.
Comment #16
dqdThanks to @catch chiming in very quick in Slack after my ping, he pointed me to the other open issue mentioned in #9. Which I was aware of, but I thought it should be rather closed in fav of this here since it is the newer one. But I was taking another look on it to be sure they 100% overlap and if it has more reasons to keep open and so we are quite sure that we can close this issue here as duplicate in favor of #3068442: Error: Call to a member function getConfigDependencyKey() on null in web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php .
Even if the other one is younger (usually we keep the older open). I hope we do not miss anything here. A closer look into the new one shows that is has already test coverage. 1+
But it uses isset() instead of is_null() or null != which is opinionated and should maybe revealed and mentioned one more time in the comparison of both issues, not sure.EDIT: sorry I have missed this review on the former patches explaining it.I will recommend to change the status of this one here as closed as duplicate in favor of #3068442. But #3068442 needs an issue summary and title update then to cover the underlying issue.
Comment #17
dqdComment #18
catchMarking duplicate of #3068442: Error: Call to a member function getConfigDependencyKey() on null in web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
Comment #19
sam.foster commented**** edit *****
re why the patches weren't applying....
I was an idiot! - I had somehow got into a position where cweagans/composer-patches had been removed from the composer.json file
So it wasn't even trying to add the patch
With that fixed via
>composer require cweagans/composer-patches
I just did
> composer update --lock
and boom! patch installed and the drush updb ran as required
also the place to put the patch is in the drupal/core section of the composer.json
-------------------
Hey all,
(updated before I even posted ! - as writing it gave me an idea - and it fixed my issue and now I've decided to post so anyone having same issue as me can see what I did - which was to manually apply code changes in https://www.drupal.org/files/issues/2021-12-09/2957376.patch by editing the /core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php file as I don't quite see how to actually re-roll a patch to share my fix - but I will be looking at that in a mo!)
I'm running updates from Drupal 8.9.20 to 9.5.11 and now seeing this error when running 'drush updb' and in relation to the
views update 'sort_identifier'
> [notice] Update started: views_post_update_sort_identifier
> [error] Error: Call to a member function getConfigDependencyKey() on null in Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid->calculateDependencies() (line 427 of /var/www/html/docroot/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php) #0 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(71): Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid->calculateDependencies()
> #1 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(89): Drupal\views\Plugin\views\display\DisplayPluginBase->getPluginDependencies(Object(Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid))
> #2 [internal function]: Drupal\views\Plugin\views\display\DisplayPluginBase->calculatePluginDependencies(Object(Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid), 18)
> #3 /var/www/html/docroot/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(959): array_walk(Array, Array)
> #4 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(71): Drupal\views\Plugin\views\display\DisplayPluginBase->calculateDependencies()
> #5 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(89): Drupal\Core\Config\Entity\ConfigEntityBase->getPluginDependencies(Object(Drupal\views\Plugin\views\display\DefaultDisplay))
> #6 /var/www/html/docroot/core/modules/views/src/Entity/View.php(282): Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies(Object(Drupal\views\Plugin\views\display\DefaultDisplay))
> #7 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(320): Drupal\views\Entity\View->calculateDependencies()
> #8 /var/www/html/docroot/core/modules/views/src/Entity/View.php(292): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
> #9 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\views\Entity\View->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
> #10 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\views\Entity\View))
> #11 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(253): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\views\Entity\View))
> #12 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\views\Entity\View))
> #13 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(608): Drupal\Core\Entity\EntityBase->save()
> #14 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(192): Drupal\Core\Config\Entity\ConfigEntityBase->save()
> #15 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(147): Drupal\Core\Config\Entity\ConfigEntityUpdater->doOne(Object(Drupal\views\Entity\View), Object(Closure))
> #16 /var/www/html/docroot/core/modules/views/views.post_update.php(88): Drupal\Core\Config\Entity\ConfigEntityUpdater->update(Array, 'view', Object(Closure))
> #17 /var/www/html/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(288): views_post_update_sort_identifier(Array)
> #18 /var/www/html/vendor/drush/drush/includes/batch.inc(256): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('views_post_upda...', Object(DrushBatchContext))
> #19 /var/www/html/vendor/drush/drush/includes/batch.inc(201): _drush_batch_worker()
> #20 /var/www/html/vendor/drush/drush/includes/batch.inc(95): _drush_batch_command('2632')
> #21 /var/www/html/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(131): drush_batch_command('2632')
> #22 [internal function]: Drush\Commands\core\UpdateDBCommands->process('2632', Array)
> #23 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
> #24 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #25 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #26 /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))
> #27 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #28 /var/www/html/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #29 /var/www/html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #30 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #31 /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))
> #32 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #33 /var/www/html/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
> #34 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
> #35 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
> #36 {main}
> [warning] Drush command terminated abnormally.
putting these patches in and running 'composer update --lock' to add the patches as I do for other such issues. These patches not applying - and I think I tried the all now - but I'm not confident I have added to the right section of my composer.json
Should they be added to 'drupal/core' or 'drupal/views' or 'drupal/taxonomy'
Or is it just these patches don't yet work for 9.5.11?
Sam
(as above - I worked out that the code in the patch https://www.drupal.org/files/issues/2021-12-09/2957376.patch seems to fix the issue in Drupal 9.5.11 it's just that it doesn't successfully apply with Composer for reasons I'm not entirely clear on but which probably relate to the diff between the patch and the target file) - at least having manually changed the code and run drush updb I am now getting a successful outcome of updb.
Can anyone tell me though - should I really roll back to an earlier version on Drupal and apply a patch successfully or won't it matter if the update has now run using 9.5.11?
Comment #20
akhil babu.
Comment #21
akhil babuAdded the comment in the wrong issue. Removing the tags