Title: PHP notice when checking for frontpage
Last modified: September 11, 2019

---

# PHP notice when checking for frontpage

 *  [quiron](https://wordpress.org/support/users/quiron/)
 * (@quiron)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/php-notice-when-checking-for-frontpage/)
 * 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 6 years, 9 months ago by [quiron](https://wordpress.org/support/users/quiron/).

The topic ‘PHP notice when checking for frontpage’ is closed to new replies.

 * ![](https://ps.w.org/pixelyoursite/assets/icon-256x256.jpg?rev=3178123)
 * [PixelYourSite - Your smart PIXEL (TAG) & API Manager](https://wordpress.org/plugins/pixelyoursite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pixelyoursite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pixelyoursite/)
 * [Active Topics](https://wordpress.org/support/plugin/pixelyoursite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pixelyoursite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pixelyoursite/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [quiron](https://wordpress.org/support/users/quiron/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/php-notice-when-checking-for-frontpage/)
 * Status: not a support question