• 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)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP warning with fix ( $url[“path’] )’ is closed to new replies.