2

my core forum module installation gone wrong on a drupal 8.5.1 system and now, when I want to uninstall it I get:

    $ drush pmu --verbose forum
    Executing: mysql --defaults-extra-file=/tmp/drush_R3Uhpd --database=drupal_2 --host=localhost --port=3306 --silent  < /tmp/drush_enDNb4
    Executing: mysql --defaults-extra-file=/tmp/drush_OWoaeC --database=drupal_2 --host=localhost --port=3306 --silent  < /tmp/drush_3gNq9b
    The following extensions will be uninstalled: forum
    Do you really want to continue? (y/n): y
    array_flip(): Can only flip STRING and INTEGER values! EntityStorageBase.php:227                                                                                                                    [warning]
    TypeError: Argument 1 passed to Drupal\forum\ForumUninstallValidator::hasTermsForVocabulary() must implement interface Drupal\taxonomy\VocabularyInterface, null given, called in                   [error]
    /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php on line 61 in Drupal\forum\ForumUninstallValidator->hasTermsForVocabulary() (line 103 of
    /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php) 
    #0 /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php(61): Drupal\forum\ForumUninstallValidator->hasTermsForVocabulary(NULL)
    #1 /usr/local/www/drupal2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(560): Drupal\forum\ForumUninstallValidator->validate('forum')
    #2 /usr/local/www/drupal2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(365): Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array)
    #3 /usr/local/www/drupal2/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91): Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
    #4 /vendor/drush/drush/commands/core/drupal/environment.inc(227): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
    #5 /vendor/drush/drush/commands/core/drupal/pm_8.inc(79): drush_module_uninstall(Array)
    #6 /vendor/drush/drush/commands/pm/pm.drush.inc(1250): _drush_pm_uninstall(Array)
    #7 /vendor/drush/drush/includes/command.inc(422): drush_pm_uninstall('forum')
    #8 /vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
    #9 /vendor/drush/drush/includes/command.inc(199): drush_command('forum')
    #10 /vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
    #11 /vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
    #12 /vendor/drush/drush/drush.php(12): drush_main()
    #13 {main}.
    TypeError: Argument 1 passed to Drupal\forum\ForumUninstallValidator::hasTermsForVocabulary() must implement interface Drupal\taxonomy\VocabularyInterface, null given, called in /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php on line 61 in /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php on line 103 #0 /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php(61): Drupal\forum\ForumUninstallValidator->hasTermsForVocabulary(NULL)
    #1 /usr/local/www/drupal2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(560): Drupal\forum\ForumUninstallValidator->validate('forum')
    #2 /usr/local/www/drupal2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(365): Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array)
    #3 /usr/local/www/drupal2/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91): Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
    #4 /vendor/drush/drush/commands/core/drupal/environment.inc(227): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
    #5 /vendor/drush/drush/commands/core/drupal/pm_8.inc(79): drush_module_uninstall(Array)
    #6 /vendor/drush/drush/commands/pm/pm.drush.inc(1250): _drush_pm_uninstall(Array)
    #7 /vendor/drush/drush/includes/command.inc(422): drush_pm_uninstall('forum')
    #8 /vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
    #9 /vendor/drush/drush/includes/command.inc(199): drush_command('forum')
    #10 /vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
    #11 /vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
    #12 /vendor/drush/drush/drush.php(12): drush_main()
    #13 {main}
    TypeError: Argument 1 passed to Drupal\forum\ForumUninstallValidator::hasTermsForVocabulary() must implement interface Drupal\taxonomy\VocabularyInterface, null given, called in /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php on line 61 in Drupal\forum\ForumUninstallValidator->hasTermsForVocabulary() (line 103 of /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php).
    Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                  [error]
    A non well formed numeric value encountered drush.inc:1671

How can I uninstall this module, because this problem leads to crash on the admin/modules/uninstall page:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\forum\ForumUninstallValidator::hasTermsForVocabulary() must implement interface Drupal\taxonomy\VocabularyInterface, null given, called in /usr/local/www/drupal2/core/modules/forum/src/ForumUninstallValidator.php on line 61 in Drupal\forum\ForumUninstallValidator->hasTermsForVocabulary() (line 103 of core/modules/forum/src/ForumUninstallValidator.php).

My server config: Apache/2.4.29 (FreeBSD) OpenSSL/1.0.1u-freebsd PHP/7.1.14

PHP Ver. 7.1.14

DB MySQL Ver. 5.6.37

EDIT:

I forgot to mention, that admin/structure/forum gives me this:

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 227 of /usr/local/www/drupal2/core/lib/Drupal/Core/Entity/EntityStorageBase.php)
#0 /usr/local/www/drupal2/core/includes/bootstrap.inc(582): _drupal_error_handler_real(2, 'array_flip(): C...', '/usr/local/www/...', 227, Array) 
#1 [internal function]: _drupal_error_handler(2, 'array_flip(): C...', '/usr/local/www/...', 227, Array) 
#2 /usr/local/www/drupal2/core/lib/Drupal/Core/Entity/EntityStorageBase.php(227): array_flip(Array) 
#3 /usr/local/www/drupal2/core/lib/Drupal/Core/Entity/EntityStorageBase.php(212): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) 
#4 /usr/local/www/drupal2/core/modules/forum/src/Form/Overview.php(54): Drupal\Core\Entity\EntityStorageBase->load(NULL) 
#5 [internal function]: Drupal\forum\Form\Overview->buildForm(Array, Object(Drupal\Core\Form\FormState), NULL) 
#6 /usr/local/www/drupal2/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array) 
#7 /usr/local/www/drupal2/core/lib/Drupal/Core/Form/FormBuilder.php(271): Drupal\Core\Form\FormBuilder->retrieveForm('forum_overview', Object(Drupal\Core\Form\FormState)) 
#8 /usr/local/www/drupal2/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('forum_overview', Object(Drupal\Core\Form\FormState)) 
#9 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) 
#10 /usr/local/www/drupal2/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) 
#11 /usr/local/www/drupal2/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#12 /usr/local/www/drupal2/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#13 /usr/local/www/drupal2/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) 
#14 /usr/local/www/drupal2/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#15 /usr/local/www/drupal2/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 
#16 /usr/local/www/drupal2/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#17 /usr/local/www/drupal2/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#18 /usr/local/www/drupal2/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#19 /usr/local/www/drupal2/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#20 /usr/local/www/drupal2/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#21 /usr/local/www/drupal2/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#22 /usr/local/www/drupal2/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#23 /usr/local/www/drupal2/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#24 /usr/local/www/drupal2/core/lib/Drupal/Core/DrupalKernel.php(664): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#25 /usr/local/www/drupal2/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 
#26 {main}. 

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 227 of core/lib/Drupal/Core/Entity/EntityStorageBase.php). 

Page not found.

THX

  • My guess would be when you enabled the forum module it created some taxonomy vocabularies and terms and you deleted them manually before doing the uninstall and the uninstall is trying to delete them but they no longer exist – Leigh Apr 9 '18 at 14:56
  • I did not deleted anything. Like I sad...the web UI instalation of the forum modeule crashed. Then I did a composer/drush based reinstall of the geocoder module and then I found that the crashed forum install is blocking the admin/modules/uninstall feature. – saniel Apr 10 '18 at 7:26
1

Just re-create Forums vocabulary and then you should be able able to uninstall the module.

  • But how to do that? Is there some sql scritp to create the missing vocabulary? – saniel Apr 10 '18 at 7:29
  • Please read drupal.org/docs/user_guide/en/structure-taxonomy-setup.html to learn how to create taxonomy vocabularies. – AltaGrade Apr 11 '18 at 4:58
  • admin/structure/taxonomy/add gives me this: Drupal\Core\Entity\EntityMalformedException: The entity does not have an ID. in Drupal\Core\Config\Entity\ConfigEntityStorage->save() (line 248 of /usr/local/www/drupal2/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php). – saniel Apr 11 '18 at 8:15
1

You can temporally edit core/modules/forum/src/ForumUninstallValidator.php like that:

  /**
   * Determines if there are any taxonomy terms for a specified vocabulary.
   *
   * @param \Drupal\taxonomy\VocabularyInterface $vocabulary
   *   The vocabulary to check for terms.
   *
   * @return bool
   *   TRUE if there are terms for this vocabulary, FALSE otherwise.
   */
  protected function hasTermsForVocabulary(VocabularyInterface $vocabulary = NULL) {
    return FALSE;
    $terms = $this->entityTypeManager->getStorage('taxonomy_term')->getQuery()
      ->condition('vid', $vocabulary->id())
      ->accessCheck(FALSE)
      ->range(0, 1)
      ->execute();
    return !empty($terms);
  }

This way you will be able to uninstall the module. Then don't forget to rollback your changes!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.