protected function is_valid_path($path) {
        $rp_substr = substr(realpath($path) . DIRECTORY_SEPARATOR, 0, strlen(realpath($this->path_to_files))) . DIRECTORY_SEPARATOR;
        $rp_files = realpath($this->path_to_files) . DIRECTORY_SEPARATOR;

        // handle better symlinks & network path - issue #448
        $pattern = ['/\\\\+/', '/\/+/'];
        $replacement = ['\\\\', '/'];
        $rp_substr = preg_replace($pattern, $replacement, $rp_substr);
        $rp_files = preg_replace($pattern, $replacement, $rp_files);
        $match = ($rp_substr === $rp_files);

        if (!$match) {
            Log::info('Invalid path "' . $path . '"');
            Log::info('real path: "' . $rp_substr . '"');
            Log::info('path to files: "' . $rp_files . '"');
        }
        return $match;
    }
protected function is_valid_path($path) {
        $rp_substr = substr(realpath($path) . DIRECTORY_SEPARATOR, 0, strlen(realpath($this->path_to_files))) . DIRECTORY_SEPARATOR;
        $rp_files = realpath($this->path_to_files) . DIRECTORY_SEPARATOR;

        // handle better symlinks & network path - issue #448
        $pattern = ['/\\\\+/', '/\/+/'];
        $replacement = ['\\\\', '/'];
        $rp_substr = preg_replace($pattern, $replacement, $rp_substr);
        $rp_files = preg_replace($pattern, $replacement, $rp_files);
        $match = ($rp_substr === $rp_files);

        if (!$match) {
            Log::info('Invalid path "' . $path . '"');
            Log::info('real path: "' . $rp_substr . '"');
            Log::info('path to files: "' . $rp_files . '"');
        }
        return $match;
    }
protected function is_valid_path ( $ path ) { $ rp_substr = substr ( realpath ( $ path ) . DIRECTORY_SEPARATOR , 0 , strlen ( realpath ( $ this -> path_to_files ) ) ) . DIRECTORY_SEPARATOR ; $ rp_files = realpath ( $ this -> path_to_files ) . DIRECTORY_SEPARATOR ; // handle better symlinks & network path - issue #448 $ pattern = [ '/\\\\+/' , '/\/+/' ] ; $ replacement = [ '\\\\' , '/' ] ; $ rp_substr = preg_replace ( $ pattern , $ replacement , $ rp_substr ) ; $ rp_files = preg_replace ( $ pattern , $ replacement , $ rp_files ) ; $ match = ( $ rp_substr === $ rp_files ) ; if ( ! $ match ) { Log :: info ( 'Invalid path "' . $ path . '"' ) ; Log :: info ( 'real path: "' . $ rp_substr . '"' ) ; Log :: info ( 'path to files: "' . $ rp_files . '"' ) ; } return $ match ; }
Check whether path is valid by comparing paths
@param string $path
@return bool
Check whether path is valid by comparing paths