Deprecated function: str_replace(): Passing null to parameterโ€”Views TermName

Created on 28 January 2023, over 1 year ago
Updated 15 September 2024, about 1 month ago

It's triggered by Taxonomy term Contextual filter that sets "Provide default value" to "Raw value from URL" and is triggered on a page without the argument in the URL.

Steps to reproduce

Steps to reproduce
To reproduce getting the log message you can use Standard Drupal installation (Tags Vocabulary).

Here is the export of the Views in question, and the log message on D10 (original message is for D9):

https://gitlab.com/-/snippets/2491413

After you import the Views place the Block "Terms" into a region of your theme, visit a page where the Block is supposed to be visible and it will trigger the log message.

Views still output correct results (on the test site as well as on the site where the whole setup makes sense), the only downside AFAICT with this particular setup is the log message.

Other conditions:
"Specify validation criteria" under "When the filter value IS available or a default is provided" must be turned ON to trigger the message.

If it's left to "Basic validation" the Page where the Block is shown is WSOD.

If Validator gets set to "Taxonomy term name" it's still showing WSOD on the page with the Block:

> Drupal\Core\Database\InvalidQueryException: Query condition 'taxonomy_term_field_data.name IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 106 of /var/www/html/viewstest/web/core/lib/Drupal/Core/Database/Query/Condition.php).

If I turn on "Transform dashes in URL to spaces in term name filter values" the page with the Block appears and it triggers the reported message.

"Transform spaces to dashes in URL" under "More" doesn't seem to affect getting the log message.

https://www.drupal.org/project/drupal/issues/3337146#comment-14897121 ๐Ÿ› Deprecated function: str_replace(): Passing null to parameterโ€”Views TermName Postponed: needs info

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\taxonomy\Plugin\views\argument_validator\TermName->validateArgument() (line 66 of /var/www/html/web/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php)


#0 /var/www/html/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/html/web/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php(66): str_replace()
#3 /var/www/html/web/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php(1012): Drupal\taxonomy\Plugin\views\argument_validator\TermName->validateArgument()
#4 /var/www/html/web/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php(1047): Drupal\views\Plugin\views\argument\ArgumentPluginBase->validateArgument()
#5 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1106): Drupal\views\Plugin\views\argument\ArgumentPluginBase->setArgument()
#6 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1272): Drupal\views\ViewExecutable->_buildArguments()
#7 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1396): Drupal\views\ViewExecutable->build()
#8 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1459): Drupal\views\ViewExecutable->execute()
#9 /var/www/html/web/core/modules/views/src/Plugin/views/display/Block.php(131): Drupal\views\ViewExecutable->render()
#10 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1635): Drupal\views\Plugin\views\display\Block->execute()
#11 /var/www/html/web/core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay()
#12 /var/www/html/web/core/modules/views/src/Plugin/Block/ViewsBlock.php(59): Drupal\views\Element\View::preRenderViewElement()
#13 /var/www/html/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\views\Plugin\Block\ViewsBlock->build()
#14 [internal function]: Drupal\block\BlockViewBuilder::preRender()
#15 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#17 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#18 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#19 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#20 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#21 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(61): Drupal\Core\Template\TwigExtension->escapeFilter()
#22 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_4f202583c59c9a72a8fbb5a0107014df->doDisplay()
#23 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#24 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#25 /var/www/html/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#26 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#27 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#28 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#29 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#30 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(80): Drupal\Core\Template\TwigExtension->escapeFilter()
#31 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_c66f7fcb4353238e09a1664cb673b9af->doDisplay()
#32 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#33 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#34 /var/www/html/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#35 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#36 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#37 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#38 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(162): Drupal\Core\Render\Renderer->render()
#39 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#40 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(163): Drupal\Core\Render\Renderer->executeInRenderContext()
#41 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#42 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#43 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#44 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#45 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#46 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#47 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#48 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#49 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
#50 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
#51 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#52 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#53 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#54 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle()
#55 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#56 {main}

.
๐Ÿ› Bug report
Status

Active

Version

11.0 ๐Ÿ”ฅ

Component
Taxonomyย  โ†’

Last updated about 2 hours ago

  • Maintained by
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States @xjm
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @catch
Created by

๐Ÿ‡ญ๐Ÿ‡ทCroatia portulaca

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024