Problem/Motivation
I'm seeing the following when viewing a certain view page on my site:
Deprecated function: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in Drupal\views\Plugin\views\argument\Formula->getFormula() (line 36 of core/modules/views/src/Plugin/views/argument/Formula.php).
Drupal\views\Plugin\views\argument\Formula->getFormula() (Line: 140)
Drupal\views\Plugin\views\argument\Date->getFormula() (Line: 61)
Drupal\views\Plugin\views\argument\Formula->query() (Line: 1116)
Drupal\views\ViewExecutable->_buildArguments() (Line: 1878)
Drupal\views\ViewExecutable->buildTitle() (Line: 43)
metatag_views_get_view_tags(Object, 'page_2', Array) (Line: 87)
metatag_views_metatags_alter(Array, Array, NULL) (Line: 562)
Drupal\Core\Extension\ModuleHandler->alter('metatags', Array, Array) (Line: 517)
metatag_get_tags_from_route() (Line: 130)
metatag_page_attachments(Array) (Line: 315)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}(Object, 'metatag') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('page_attachments', Object) (Line: 316)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 289)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 290)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
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: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
The site's on php 8.1 (and right now on core 9.5.11, though ran into this while prepping it for D10), and metatag should probably be upgraded 2.x, but I'm currently apparently stuck on 1.x until maybe after I can deploy an upgrade to lightning_core to get it to its next major version. But then again, line 27 of metatag_views.module (which I assume is part of the cause?) looks the same on the 2.0.x branch, so maybe this would persist.
My apologies if this isn't quite enough info to help, as I'm not super familiar with the site, this view, how metatag is configured on it, etc., quite yet (let alone the workings of how metatag is interacting with core, etc.).
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork metatag-3401733
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
damienmckennaThank you for reporting the bug report. This looks like it'll be an easy fix.
Comment #4
admirlju commentedI'm finding it hard to replicate the issue. Could you check what tags do you have set for this specific view, that throws this error? From the error I assume it's some data, that contains a date in it.
Comment #5
sashken2 commentedI have same issue too. I'm using date_recur module and using date field in metatag views.
Comment #6
ruslan piskarovI see the same issue and have a view with the date_recur field. Unfortunately, I didn't find time for debugging. However, I think is needed to investigate the view and date_recur module.
I tried to comment $view->buildTitle() in metatag_views_metatags_alter() and it helped me as a temporary solution.
FYI, I use metatag v2+.