Problem/Motivation
I am seeing this on any page where simple_popup_block is displayed.
Full text of the error is:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in Drupal\Component\Utility\Html::escape() (line 424 of /code/web/core/lib/Drupal/Component/Utility/Html.php)
#0 /code/web/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'htmlspecialchar...', '/code/web/core/...', 424, Array)
#1 [internal function]: _drupal_error_handler(2, 'htmlspecialchar...', '/code/web/core/...', 424, Array)
#2 /code/web/core/lib/Drupal/Component/Utility/Html.php(424): htmlspecialchars(Array, 11, 'UTF-8')
#3 [internal function]: Drupal\Component\Utility\Html::escape(Array)
#4 /code/web/modules/contrib/simple_popup_blocks/simple_popup_blocks.module(58): array_map('Drupal\\Componen...', Array)
#5 /code/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(297): simple_popup_blocks_page_attachments(Array)
#6 /code/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(273): Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array)
#7 /code/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#8 /code/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#9 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#10 /code/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#11 /code/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent))
#12 /code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#13 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /code/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#20 {main}
It looks like the entry in config is causing the issue:
_core:
default_config_hash: XBucOv5lwgVzHOV3HANT7Ekf7Ul1Ah4LnT-LjsPmO_I
because that piece of config is turned into an array and not a string when the config is loaded.
Steps to reproduce
Add a simple block to a page, load the page, and check the "Recent log message".
Proposed resolution
Unset the
$data['_core']
hash before calling the array_map
function. This doesn't need to be communicated as a setting anyway, I'd imagine.
Remaining tasks
Add patch/fork.