file : file_exists do not raise an exception if a parent or the path is missing
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3002 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
11
file.php
11
file.php
@@ -68,7 +68,15 @@ class file
|
|||||||
{
|
{
|
||||||
$this->debug (2, "file_exists ($filename)");
|
$this->debug (2, "file_exists ($filename)");
|
||||||
$filename = $this->realpath ($filename);
|
$filename = $this->realpath ($filename);
|
||||||
$this->checkPathRO (dirname ($filename));
|
try
|
||||||
|
{
|
||||||
|
$this->checkPathRO (dirname ($filename));
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
if ($e->getCode () !== 404)
|
||||||
|
throw new \Exception ($e->getMessage (), $e->getCode ());
|
||||||
|
}
|
||||||
if (file_exists ($filename) && ! is_link ($filename))
|
if (file_exists ($filename) && ! is_link ($filename))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -518,7 +526,6 @@ class file
|
|||||||
if (! file_exists ($path))
|
if (! file_exists ($path))
|
||||||
{
|
{
|
||||||
$this->debug (1, "checkPathRO ($path) => Path '$path' not found");
|
$this->debug (1, "checkPathRO ($path) => Path '$path' not found");
|
||||||
return $this->checkExternalPathRO ($path);
|
|
||||||
throw new \Exception (sprintf (dgettext ("domframework",
|
throw new \Exception (sprintf (dgettext ("domframework",
|
||||||
"Path '%s' not found"),
|
"Path '%s' not found"),
|
||||||
$path), 404);
|
$path), 404);
|
||||||
|
|||||||
Reference in New Issue
Block a user