D10 TypeError: htmlspecialchars()

Created on 10 March 2025, about 2 months ago

Hi friends! I'm Diana!
I am working in a personal module, I use Drupal 10 i 8.2 PHP.
The past days I made a migration of Drupal 7 only with .yaml and API Migrate of Drupal, because I can't use Composer or drush because the hosting is a sh***.
I have an error in the next part of the website: ..../admin/reports/dblog

When I execute this url, the message is:

TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars() (line 432 of core/lib/Drupal/Component/Utility/Html.php).

Drupal\Component\Utility\Html::escape(Array) (Line: 265)
Drupal\Component\Render\FormattableMarkup::placeholderEscape(Array) (Line: 216)
Drupal\Component\Render\FormattableMarkup::placeholderFormat('Fecha seleccionada: @fecha', Array) (Line: 99)
Drupal\Component\Render\FormattableMarkup->__toString() (Line: 1263)
Drupal\views\Plugin\views\field\FieldPluginBase->renderText(Array) (Line: 1202)
Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object) (Line: 238)
template_preprocess_views_view_field(Array, 'views_view_field', Array)
call_user_func_array('template_preprocess_views_view_field', Array) (Line: 285)
Drupal\Core\Theme\ThemeManager->render('views_view_field', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 1763)
Drupal\views\Plugin\views\field\FieldPluginBase->theme(Object) (Line: 755)
Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 694)
Drupal\views\Plugin\views\style\StylePluginBase->renderFields(Array) (Line: 560)
Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping(Array, Array, 1) (Line: 448)
Drupal\views\Plugin\views\style\StylePluginBase->render(Array) (Line: 2179)
Drupal\views\Plugin\views\display\DisplayPluginBase->render() (Line: 1547)
Drupal\views\ViewExecutable->render() (Line: 195)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1644)
Drupal\views\ViewExecutable->executeDisplay('page', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 168)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 675)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The problem is that in the new module I wrote ...'Fecha seleccionada: @fecha', Array... but now I deleted this part of code, and the error persist.

I made trunk in a cache tables of DDBB.

I don't know if this problem is from the prehistorical migration, from the new module or from both.

Please help.
ThankU

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain dianacp

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

Comments & Activities

Production build 0.71.5 2024