skip to Main Content

I’ve the latest magento’s version with PHP 8.1
Upgrade from older version.
When place order in default language all is ok.
When place order in other language (is a multilanguage store) an error occurred:
main.CRITICAL: Exception: Deprecated Functionality: str_replace(): Passing null to parameter #3
I’ve stripe module installed.

In older version of magento I’ve also a module for "pay on delivery" but I’m sure I’ve removed it.
My idea is there is some trace in DB or code of the older module "pay on delivery"

Can someone help me to find the problem? to debug?

Thanks

2

Answers


  1. The file in which you are getting the error for str_replace, find the line no. and check the code if you are not sure then.

    Example: $onlyconsonants = str_replace($vowels, "", "Hello World of PHP");

    if the code is something like this replace with

    $onlyconsonants = str_replace($vowels ?? ”, "", "Hello World of PHP");

    Login or Signup to reply.
  2. You are using a deprecated function str_replace() in your Magento 2 code. The str_replace() function has been flagged as deprecated in PHP 8.1 version, which means that it is no longer recommended for use and may be removed in future versions of the language.

    To resolve this you can use ‘strtr()’ function, which performs the same task of replacing characters or substrings in a string.

    For example Replace the string "Hello world" with "Hi earth":

    $arr = array("Hello" => "Hi", "world" => "earth");

    echo strtr("Hello world",$arr);

    You need to search for and replace all instances of str_replace() in your code to resolve the issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search