Crash in module installer if a dependency is missing

Created on 15 August 2023, 11 months ago
Updated 16 March 2024, 3 months ago

The modules installs fine but when I want to enable it, the website throws an error: TypeError : htmlspecialchars(): Argument #1 ($string) must be of type string, array given dans htmlspecialchars() and I can't enable the module, I tried 1.2.2 and 1.3.1 and I have the same issue.
I have Drupal 9.5.9 with PHP 8.1.

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

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

Comments & Activities

  • Issue created by @fabricet
  • Status changed to Closed: cannot reproduce 11 months ago
  • 🇮🇳India keshav.k

    Not able to reproduce the issue, Please provide more details.

  • Here is the full error message I'm getting:

    TypeError : htmlspecialchars(): Argument #1 ($string) must be of type string, array given dans htmlspecialchars() (/home/tbpzego/www/core/lib/Drupal/Component/Utility/Html.php ligne 432)
    #0 /home/tbpzego/www/core/lib/Drupal/Component/Utility/Html.php(432): htmlspecialchars(Array, 11, 'UTF-8')
    #1 /home/tbpzego/www/core/lib/Drupal/Component/Render/FormattableMarkup.php(270): Drupal\Component\Utility\Html::escape(Array)
    #2 /home/tbpzego/www/core/lib/Drupal/Component/Render/FormattableMarkup.php(216): Drupal\Component\Render\FormattableMarkup::placeholderEscape(Array)
    #3 /home/tbpzego/www/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(195): Drupal\Component\Render\FormattableMarkup::placeholderFormat('@requirements_m...', Array)
    #4 /home/tbpzego/www/core/lib/Drupal/Component/Utility/ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
    #5 /home/tbpzego/www/core/lib/Drupal/Core/Messenger/Messenger.php(54): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
    #6 /home/tbpzego/www/core/lib/Drupal/Core/Messenger/Messenger.php(46): Drupal\Core\Messenger\Messenger->addMessage(Object(Drupal\Core\StringTranslation\TranslatableMarkup), 'error', false)
    #7 /home/tbpzego/www/core/includes/install.inc(1052): Drupal\Core\Messenger\Messenger->addError(Object(Drupal\Core\StringTranslation\TranslatableMarkup))
    #8 /home/tbpzego/www/core/modules/system/src/Form/ModulesListForm.php(463): drupal_check_module('symfony_mailer')
    #9 /home/tbpzego/www/core/modules/system/src/Form/ModulesListForm.php(481): Drupal\system\Form\ModulesListForm->buildModuleList(Object(Drupal\Core\Form\FormState))
    #10 [internal function]: Drupal\system\Form\ModulesListForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
    #11 /home/tbpzego/www/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
    #12 /home/tbpzego/www/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
    #13 /home/tbpzego/www/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
    #14 /home/tbpzego/www/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('system_modules', Array, Object(Drupal\Core\Form\FormState))
    #15 /home/tbpzego/www/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\system\Form\ModulesListForm), Object(Drupal\Core\Form\FormState))
    #16 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
    #17 /home/tbpzego/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #18 /home/tbpzego/www/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #19 /home/tbpzego/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #20 /home/tbpzego/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #21 /home/tbpzego/www/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #22 /home/tbpzego/www/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #23 /home/tbpzego/www/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #24 /home/tbpzego/www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #25 /home/tbpzego/www/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #26 /home/tbpzego/www/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #27 /home/tbpzego/www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #28 /home/tbpzego/www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #29 /home/tbpzego/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #30 /home/tbpzego/www/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #31 /home/tbpzego/www/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #32 {main}

  • Status changed to Active 11 months ago
  • Status changed to Postponed: needs info 11 months ago
  • 🇬🇧United Kingdom AdamPS

    OK, but 12k sites use the module and it works for the others. So we do need more details as asked in #2.

  • Status changed to Active 10 months ago
  • 🇬🇧United Kingdom AdamPS

    OK I looked carefully at your debug trance and I can reproduce it.

    You are missing one of the dependencies of this module. The instructions are here https://www.drupal.org/docs/contributed-modules/drupal-symfony-mailer/ge... .

    This module has a bug in the case of missing dependencies. Although it works fine on the status report, it doesn't work in the module installer. The code in drupal_check_module() uses the returned requirement data is a somewhat strange way.

  • I encountered the same problem when enabling Drupal Symfony Mailer.

    AdamPS & fabricet, could you please share what dependencies are needed? I couldn't find any from the link in #7.

    Here are my trace information:

    #0 /chroot/home/aab0448d/86038db258.nxcli.io/html/vendor/symfony/mime/Header/Headers.php(108): Symfony\Component\Mime\Address->__construct(' #1 /chroot/home/aab0448d/86038db258.nxcli.io/html/vendor/symfony/mime/Header/Headers.php(154): Symfony\Component\Mime\Header\Headers->addPathHeader('Return-Path', ' #2 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php(104): Symfony\Component\Mime\Header\Headers->addHeader('Return-Path', ' #3 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/mailsystem/src/Adapter.php(50): Drupal\Core\Mail\Plugin\Mail\PhpMail->mail(Array)
    #4 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Mail/MailManager.php(307): Drupal\mailsystem\Adapter->mail(Array)
    #5 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Mail/MailManager.php(180): Drupal\Core\Mail\MailManager->doMail('rules', 'rules_action_ma...', 'shirleyzhu68@gm...', 'site_default', Array, 'Jiaherbal@gmail...', true)
    #6 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\Mail\MailManager->Drupal\Core\Mail\{closure}()
    #7 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Mail/MailManager.php(181): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #8 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/mailsystem/src/MailsystemManager.php(70): Drupal\Core\Mail\MailManager->mail('rules', 'rules_action_ma...', 'shirleyzhu68@gm...', 'site_default', Array, 'Jiaherbal@gmail...', true)
    #9 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/Plugin/RulesAction/SystemSendEmail.php(126): Drupal\mailsystem\MailsystemManager->mail('rules', 'rules_action_ma...', 'shirleyzhu68@gm...', 'site_default', Array, 'Jiaherbal@gmail...')
    #10 [internal function]: Drupal\rules\Plugin\RulesAction\SystemSendEmail->doExecute(Array, '\xE6\x82\xA8\xE7\x9A\x84\xE9\x97\xAE\xE8\xAF\x8A\xE5\x8D\x95...', '

    \r\n jh816\xEF...', 'Jiaherbal@gmail...', NULL)
    #11 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/Core/RulesActionBase.php(152): call_user_func_array(Array, Array)
    #12 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/Plugin/RulesExpression/ActionExpression.php(110): Drupal\rules\Core\RulesActionBase->execute()
    #13 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/Plugin/RulesExpression/ActionSetExpression.php(33): Drupal\rules\Plugin\RulesExpression\ActionExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
    #14 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/Plugin/RulesExpression/RuleExpression.php(121): Drupal\rules\Plugin\RulesExpression\ActionSetExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
    #15 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/Plugin/RulesExpression/ActionSetExpression.php(33): Drupal\rules\Plugin\RulesExpression\RuleExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
    #16 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/src/EventSubscriber/GenericEventSubscriber.php(161): Drupal\rules\Plugin\RulesExpression\ActionSetExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
    #17 [internal function]: Drupal\rules\EventSubscriber\GenericEventSubscriber->onRulesEvent(Object(Drupal\rules\Event\EntityEvent), 'rules_entity_up...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #18 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\rules\Event\EntityEvent), 'rules_entity_up...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #19 /chroot/home/aab0448d/86038db258.nxcli.io/html/modules/contrib/rules/rules.module(183): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\rules\Event\EntityEvent), 'rules_entity_up...')
    #20 [internal function]: rules_entity_update(Object(Drupal\node\Entity\Node))
    #21 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array(Object(Closure), Array)
    #22 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'rules')
    #23 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object(Closure))
    #24 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(217): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array)
    #25 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node))
    #26 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(564): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node))
    #27 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\node\Entity\Node), true)
    #28 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(489): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\node\Entity\Node), true)
    #29 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\node\Entity\Node))
    #30 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Entity/EntityBase.php(352): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\node\Entity\Node))
    #31 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/modules/node/src/NodeForm.php(270): Drupal\Core\Entity\EntityBase->save()
    #32 [internal function]: Drupal\node\NodeForm->save(Array, Object(Drupal\Core\Form\FormState))
    #33 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array(Array, Array)
    #34 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
    #35 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
    #36 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('node_visit_edit...', Array, Object(Drupal\Core\Form\FormState))
    #37 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState))
    #38 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
    #39 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #40 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #41 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #42 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #43 /chroot/home/aab0448d/86038db258.nxcli.io/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #44 /chroot/home/aab0448d/86038db258.nxcli.io/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #45 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #46 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #47 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #48 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #49 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #50 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #51 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #52 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #53 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #54 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #55 /chroot/home/aab0448d/86038db258.nxcli.io/html/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #56 /chroot/home/aab0448d/86038db258.nxcli.io/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #57 {main}

  • I run into same issue, but I downloaded symfony libraries with ludwig, then I could activate/install the module.

  • 🇭🇺Hungary djg_tram

    I wonder why is it so hard to document it... :-))

    The required dependencies are:

    composer require html2text/html2text
    composer require symfony/mailer
    composer require tijsverkoyen/css-to-inline-styles

    It's there in the .install file but not every Drupal admin is a programmer and would to know where to look.

Production build 0.69.0 2024