Problem/Motivation

Deprecated function: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in require_once() (line 19 of /var/www/hfspo/web/modules/contrib/taxonomy_term_depth/constants.inc)

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

Renrhaf created an issue. See original summary.

renrhaf’s picture

Status: Active » Needs review

Setting to review

hstoellinger’s picture

Hello,
I have just upgraded to PHP 8.1 (Kubuntu 22.04) and Drupal 9.3.16. Now I see the message

Deprecated function: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in require_once() (Zeile 19 in /home/hs/www/web/modules/contrib/taxonomy_term_depth/constants.inc)
#0 /home/hs/www/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /home/hs/www/web/modules/contrib/taxonomy_term_depth/constants.inc(19): str_replace()
#3 /home/hs/www/web/modules/contrib/taxonomy_term_depth/taxonomy_term_depth.module(10): require_once('...')
#4 /home/hs/www/web/core/lib/Drupal/Core/Extension/Extension.php(147): include_once('...')
#5 /home/hs/www/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(128): Drupal\Core\Extension\Extension->load()
#6 /home/hs/www/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(141): Drupal\Core\Extension\ModuleHandler->load()
#7 /home/hs/www/web/core/lib/Drupal/Core/DrupalKernel.php(586): Drupal\Core\Extension\ModuleHandler->loadAll()
#8 /home/hs/www/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(46): Drupal\Core\DrupalKernel->preHandle()
#9 /home/hs/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#10 /home/hs/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#11 /home/hs/www/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#12 /home/hs/www/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#13 /home/hs/www/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#14 /home/hs/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#15 /home/hs/www/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#16 /home/hs/www/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#17 {main}

Might a patch be available in the meantime?
Regards
H. Stoellinger

renrhaf’s picture

Hi, you can use patch from the merge request as follow : https://git.drupalcode.org/project/taxonomy_term_depth/-/merge_requests/...

hstoellinger’s picture

Issue tags: +str_replace()

Thanks! Seems to work for me (DR 9.4.3)

karimbou’s picture

We're having this issue aswell on a recent upgrade of D9.4.5 PHP8.1 every module updated, and it's messing views with elastic search passing taxonomy parameters.

googletorp’s picture

Status: Needs review » Reviewed & tested by the community

Working for me as well.

smulvih2’s picture

This works for me as well, would be nice to get this into a new release.

rar9’s picture

+1 working

jasjeet kaur brar’s picture

Tested, working for me on a Drupal version 9.5.1 . Thanks

shahzad-anwar’s picture

RTBC.
Tested and worked for me on Drupal 9.5.3 , PHP 8.1.13

joseph.olstad’s picture

liam morland’s picture

Simple patch; works correctly. +1 for commit.

liam morland’s picture

Fix from merge request as a patch.

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in dev branch, dev release

  • Liam Morland committed cd75a3c7 on 7.x-1.x authored by Renrhaf
    Issue #3283096: PHP 8.1 compatibility str_replace(): Passing null to...

Status: Fixed » Closed (fixed)

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

joseph.olstad’s picture

@Liam Morland, great work, on the rc1 release , I suggest tagging it as 7.x-1.6, it's been about 9 weeks.

liam morland’s picture

The RC was released on May 9. I typically wait until an RC is two weeks old with no release-blockers having been found before making a full release.

joseph.olstad’s picture

@Liam Morland, ok ya I must have been confused, I see the latest dev commit was last month but the RC1 release was yesterday, thanks!