简体   繁体   中英

Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

I have a problem with an old plugin installed on my Wordpress site. Since I updated my php to php 7.4, I am getting the message saying: " Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior ". The error is detected on line 454 of UpdateChecker.php file, which is the following:

$cachedResult = (strpos($pluginPath, $muPluginDir) === 0);

Could anyone please help me to solve the issue? I would really appreciate!

Thanks in advance

Cheers

As you mention the plugin has not been updated you'll need to update it yourself - the line you reference would need to be something like:

$cachedResult = (strpos($pluginPath, (string)$muPluginDir) === 0);

You may also need to search the plugin for any other instances, or at least keep an eye on your error logs for any other updates required.

If the plugin you're using is open source you may wish to submit the fix once you've tested to the package maintainers (if indeed they're still maintaining it at all).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM