I get this error :
Warning: strpos(): Empty needle in ……popularity-contest.php on
line 2574
function akpc_is_searcher() {
global $akpc;
$referrer = parse_url($_SERVER['HTTP_REFERER']);
$searchers = explode(' ', preg_replace("n|r|rn|nr", ' ', $akpc->searcher_names));
foreach ($searchers as $searcher) {
if (strpos($referrer['host'], $searcher) !== false) {
return true;
}
}
return false;
}
Can someone please help me to fix this problem?
A bunch of PHP search functions use the terms “needle” and “haystack” as their parameter names, indicating what is sought and where to seek it.
The
strpos
function is such a function. “Empty needle” means that you have passed in a null or empty value as the needle to look for. This is like saying “search for nothing” which doesn’t make sense to the function.To fix this, check that the variable that you’re passing in as the needle has an actual value. The
empty
function is a good choice for that.The warning should go away if you set WP_DEBUG to false in wp_config.php. If you want to fix it, try the following: