Replies: 0
Hello!
we are getting a PHP notice when the plugin compare URL’s checking for the front page. The message is:
( ! ) Warning: strpos(): Empty needle in /path/to/site/wp-content/plugins/pixelyoursite-pro/includes/functions-common.php on line 535
the lines are:
522 $url = rtrim( $url, '*' ); // for backward capability
523 $url = removeProtocolFromUrl( $url );
524
525 if ( ! $rule || $rule == 'match' ) {
526 return $base == $url;
527 }
528
529 if ( $rule == 'contains' ) {
530
531 if ( $base == $url ) {
532 return true;
533 }
534
535 if ( strpos( $base, $url ) !== false ) {
536 return true;
537 }
538
539 return false;
540
541 }
So, looking for the front page the $url has value / and removeProtocolFromUrl() converts it to empty string.
Because looking for frontpage don’t matter if $rule is contains or match, adding
if ( empty( $url ) ) {
return is_front_page();
}
at line 524 fixed it for us.
Will be awesome if you can include this fix in your next version. BTW I’m happy to submit a Pull or Merge request or provide a .patch if you tell me where 🙂
- This topic was modified 7 minutes ago by quiron.