close

[Solved] Deprecated: strpos(): Non-string needles will be interpreted as strings in the future

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Deprecated: strpos(): Non-string needles will be interpreted as strings in the future in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Deprecated: strpos(): Non-string needles will be interpreted as strings in the future Error Occurs?

Today I get the following error Deprecated: strpos(): Non-string needles will be interpreted as strings in the future in php.

How To Solve Deprecated: strpos(): Non-string needles will be interpreted as strings in the future Error ?

  1. How To Solve Deprecated: strpos(): Non-string needles will be interpreted as strings in the future Error ?

    To Solve Deprecated: strpos(): Non-string needles will be interpreted as strings in the future Error All you have to do is pass in a string as the parameter for strpos.

  2. Deprecated: strpos(): Non-string needles will be interpreted as strings in the future

    To Solve Deprecated: strpos(): Non-string needles will be interpreted as strings in the future Error All you have to do is pass in a string as the parameter for strpos.

Solution 1


This worked for me

$suffix = strval($this->config->item('controller_suffix'));
$pos = !empty($suffix) ? strpos($class, $suffix) : FALSE;
if ($pos === FALSE)
{
    $class .= $suffix;
}
parent::set_class($class);

Solution 2

All you have to do is pass in a string as the parameter for strpos.

strpos('_', strval($this->Category->getPath()))

Or, ensure the Category->getPath() returns a string and not a mixed type.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment