skip to Main Content

I’m having a problem with a Magento Extension.

Error:
Deprecated Functionality: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Setup/ChangeMethodsFormat.php on line 40

Line 40 is: if (strpos($oldMethods, "n") === false) {

function is:

     $oldMethods = $rule->getMethods();
        if (strpos($oldMethods, "n") === false) {
            continue;
        }

can somebody help me?

PHP Version: 8.1.7

2

Answers


  1. Chosen as BEST ANSWER

    I solved this with using:

    error_reporting( E_ALL & ~E_DEPRECATED );
    

    before:

            if (strpos($oldMethods, "n") === false){
            continue;
            }
    

    This will switch off the Depracted warning. I know it's not te best way but it's working.


  2. The error says that $oldMethods is null. So you could check for that:

    if ($oldMethods !== null || strpos($oldMethods, "n") === false){
    continue;
    }
    

    I assume that or is the correct operator.

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