Title: PHP warning with fix ( $url[&#8220;path&#8217;] )
Last modified: September 23, 2022

---

# PHP warning with fix ( $url[“path’] )

 *  Resolved [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-warning-with-fix-urlpath/)
 * Hi, for a while this plugin gives a PHP warning on PHP 8.1. The problem is in
   the file `cp-multi-view-calendar/classes/cp-base-class.inc.php`.
 * In the variable there is only a key for `path` if the website runs in a subdirectory
   like `domain.com/directory/`. Running the website from the document root like`
   domain.com/` will cause the key for `path` to not exist and emit a warning.
 * These changes should fix the warning:
    In the method `get_site_url` Change
 *     ```
           $url = parse_url($url);
           return rtrim(@$url["path"],"/");
       ```
   
 * To
 *     ```
               $url = parse_url($url);
               if ( isset( $url["path"] ) ) {
                   return rtrim(@$url["path"],"/");
               } else {
                   return "/";
               }
       ```
   
 * In the method `get_FULL_site_url`
    Change
 *     ```
           $url = parse_url($url);
           $url = rtrim($url["path"],"/");
       ```
   
 * To
 *     ```
           $url = parse_url($url);
           if ( isset( $url["path"] ) ) {
               $url = rtrim($url["path"],"/");
           } else {
               $url = "/";
           }
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-warning-with-fix-urlpath/#post-16068738)
 * Hi,
 * We will include that in the next update.
 * Thank you for the feedback!
 *  Thread Starter [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-warning-with-fix-urlpath/#post-16068994)
 * Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP warning with fix ( $url[“path’] )’ is closed to new replies.

 * ![](https://ps.w.org/cp-multi-view-calendar/assets/icon-256x256.png?rev=984491)
 * [CP Multi View Events Calendar](https://wordpress.org/plugins/cp-multi-view-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cp-multi-view-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cp-multi-view-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/cp-multi-view-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cp-multi-view-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cp-multi-view-calendar/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/php-warning-with-fix-urlpath/#post-16068994)
 * Status: resolved