Re: How to escape a local path so fopen() doesn't consider it a URL?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Whoops again, the test should be for a scheme of 2 or more characters, not
1 or more (so it doesn't match C://foo):

function make_path_local(string $path): string {
  if (\preg_match('/^([a-zA-Z0-9+\\-.]{2,}:\\/\\/|data:|zlib:)/Ds', $path))
    return '.' . \DIRECTORY_SEPARATOR . $path;
  return $path;
}

​

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux