Problem/Motivation

I get this error with Drupal 10.3.6
PHP 8.2

Deprecated function: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in Drupal\xmlfeedviews\Plugin\views\row\XmlFeedViewsFields->getBodyField() (line 205 of modules/contrib/xmlfeedviews/src/Plugin/views/row/XmlFeedViewsFields.php).
Drupal\xmlfeedviews\Plugin\views\row\XmlFeedViewsFields->getBodyField() (Line: 154)
Drupal\xmlfeedviews\Plugin\views\row\XmlFeedViewsFields->render() (Line: 179)
Drupal\xmlfeedviews\Plugin\views\style\XmlFeedViews->render() (Line: 191)
Drupal\views\Plugin\views\display\Feed->render() (Line: 1592)
Drupal\views\ViewExecutable->render() (Line: 167)
Drupal\views\Plugin\views\display\Feed->execute() (Line: 1689)
Drupal\views\ViewExecutable->executeDisplay() (Line: 81)
Drupal\views\Element\View::preRenderViewElement()
call_user_func_array() (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870)
Drupal\Core\Render\Renderer->doCallback() (Line: 432)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 152)
Drupal\Core\Render\Renderer->renderRoot() (Line: 110)
Drupal\views\Plugin\views\display\Feed::buildResponse() (Line: 56)
Drupal\views\Routing\ViewPageController->handle()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)
CommentFileSizeAuthor
#2 3486335.patch555 bytestrickfun
Command icon 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

trickfun created an issue. See original summary.

trickfun’s picture

StatusFileSize
new555 bytes

Simple patch

priti197’s picture

Solution:
Replace line 205 of /src/Plugin/views/row/XmlFeedViewsFields.php
From
$fieldLine = str_replace($fieldArray[0][$i], $data, $fieldLine);

To
$fieldLine = str_replace($fieldArray[0][$i], $data ?? '', $fieldLine);

atul_ghate made their first commit to this issue’s fork.

atul_ghate’s picture

Status: Active » Needs review

astonvictor’s picture

thanks for the report

astonvictor’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.