Some time search fine and some time getting below error.
e.g: if I search about us and getting
htttps://www.example.com/search/node?keys=about us
TypeError: strip_tags(): Argument #1 ($string) must be of type string, array given in strip_tags() (line 1120 of /code/vendor/twig/twig/src/Extension/CoreExtension.php)
This is core issue in Drupal 9 and need to fixed quickly.
Comments
Comment #2
longwaveWhat theme are you using?
Can you provide a full backtrace for the error?
Comment #3
pankaj1390 commentedI am using bootstrap barrio theme
full backtrace for the error
TypeError: strip_tags(): Argument #1 ($string) must be of type string, array given in strip_tags() (line 1120 of /code/vendor/twig/twig/src/Extension/CoreExtension.php)
#0 /code/vendor/twig/twig/src/Extension/CoreExtension.php(1120): strip_tags(Array, NULL)
#1 /tmp/rolling/live_13/twig/63d484a15a0d2_paragraph--section_six_ca_MsCeIVUMbWuwlCFVlmGB8oVEl/S-FIJS_7Jg3rOC5Tbnbp-uxqAp--unDy8P7d1QQng4U.php(111): twig_striptags(Array)
#2 /code/vendor/twig/twig/src/Template.php(405): __TwigTemplate_d0fc208014a2658a4fa7261afad5c1554728b41a1b6ca7ca4e939db924a8feb2->doDisplay(Array, Array)
#3 /code/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#4 /code/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#5 /code/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#6 /code/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/childtheme...', Array)
#7 /code/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('paragraph', Array)
#8 /code/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#9 /code/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render(Array)
#10 /tmp/rolling/live_13/twig/63d484a15a0d2_field.html.twig_0g0RGvrIcOEL0terb1vEN_PRN/REVYgcI37uj7KSrTlzMlMmitWcFLTinySvoC2COpuv0.php(67): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#11 /code/vendor/twig/twig/src/Template.php(405): __TwigTemplate_7fe1dbd914b036222150699fc1bc438b95bebc68a9386d62078211339b4472fc->doDisplay(Array, Array)
#12 /code/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#13 /code/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#14 /code/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#15 /code/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/contrib/...', Array)
#16 /code/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('field', Array)
#17 /code/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender(Array)
#18 /code/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, true)
#19 /code/web/core/lib/Drupal/Core/Render/Renderer.php(160): Drupal\Core\Render\Renderer->render(Array, true)
#20 /code/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#21 /code/web/core/lib/Drupal/Core/Render/Renderer.php(161): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#22 /code/web/core/modules/node/src/Plugin/Search/NodeSearch.php(371): Drupal\Core\Render\Renderer->renderPlain(Array)
#23 /code/web/core/modules/node/src/Plugin/Search/NodeSearch.php(242): Drupal\node\Plugin\Search\NodeSearch->prepareResults(Object(Drupal\Core\Database\StatementWrapper))
#24 /code/web/core/modules/search/src/Plugin/SearchPluginBase.php(98): Drupal\node\Plugin\Search\NodeSearch->execute()
#25 /code/web/core/modules/search/src/Controller/SearchController.php(102): Drupal\search\Plugin\SearchPluginBase->buildResults()
#26 [internal function]: Drupal\search\Controller\SearchController->view(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\search\Entity\SearchPage))
#27 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#28 /code/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#29 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#30 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#31 /code/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#32 /code/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#33 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /code/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /code/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#44 {main}
Comment #4
cilefen commentedThe theme file being rendered is something like themes/childtheme…. Is that a custom theme?
Is this replicable with Olivero theme?
What change precipitated this issue?
Comment #5
pankaj1390 commentedYes @clifen this is a custom for privacy matter I user child theme and replica of Bootstrap barrio theme
Search is not working properly few keyword getting searched but few gives error
Comment #6
cilefen commentedThat is already more information than we had. I don't know what you mean by a "replica" of a theme. Anyway, if you require urgent support you will have to be more forthcoming and answer all of our questions.
Comment #7
cilefen commentedComment #8
pankaj1390 commentedTheme is the custom theme
name: themename
type: theme
description: 'Basic structure for a theme.'
core: 8.x
core_version_requirement: ^8 || ^9
base theme: bootstrap_barrio
I am ready to Quicky answer you queries.
Comment #9
cilefen commentedPlease read again comment #4 and get those answers please. You assert this is an issue with Drupal Core but we have not yet determined that.
Also, what is on line 111 of /tmp/rolling/live_13/twig/63d484a15a0d2_paragraph--section_six_ca_MsCeIVUMbWuwlCFVlmGB8oVEl/S-FIJS_7Jg3rOC5Tbnbp-uxqAp--unDy8P7d1QQng4U.php that is passing an array to the striptags filter?
Comment #10
pankaj1390 commentedThe theme file being rendered is something like themes/childtheme…. Is that a custom theme?
Ans. Yes this is a custom theme
Is this replicable with Olivero theme?
Ans. No
What change precipitated this issue?
Ans. After migrate Drupal 8 to Drupal 9
Below is the code in the file
Comment #11
pankaj1390 commentedComment #12
cilefen commentedSomething is passing an array to the striptags Twig filter. This is not a core bug but rather an issue with that custom theme.
Comment #13
pankaj1390 commentedI am using same theme in Drupal 8 and It is working fine. I am sure this is a core issue
Comment #14
cilefen commentedAre those sites on the same version of PHP?
Comment #15
pankaj1390 commentedNo PHP <8
Comment #16
pankaj1390 commentedI see when I disabled search module and enable it worked fine
Comment #17
pankaj1390 commentedIf this is php issue it should not worked after uninstall and enabled
Comment #18
longwaveThe only use of striptags in that template is
So for some reason field_description.value appears to be an array and not a string. The next step would be figure out which entities cause the issue and find out what is different about them. These appear to be Paragraph entities, so this also could be an issue in the Paragraphs module.
Comment #19
larowlanYou shouldn't be passing value to strip tags anyway, you should be using processed
But perhaps you can fix this by adding |render before the strip tags
Comment #20
pankaj1390 commentedWhat is the role of template (twig file where it consider error) in the search that I break the search?
Comment #21
larowlanThe NodeSearch plugin renders the node in 'search result' view mode. That is ending up in your paragraph template
Comment #22
cilefen commentedThere has been no activity here in months.