Skip to content

Commit 8d1dd05

Browse files
committed
Fixed issue in #782 (@javagotchi)
1 parent 289360d commit 8d1dd05

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/Phpfastcache/Util/Directory.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,19 @@ public static function rrmdir(string $source, bool $removeOnlyChildren = false):
101101
/**
102102
* @var SplFileInfo $fileinfo
103103
*/
104-
if ($fileinfo->isDir()) {
105-
if (self::rrmdir($fileinfo->getRealPath()) === false) {
106-
return false;
107-
}
108-
} else {
109-
if (unlink($fileinfo->getRealPath()) === false) {
104+
$realpath = $fileinfo->getRealPath();
105+
if($realpath){
106+
if ($fileinfo->isDir()) {
107+
if (self::rrmdir($fileinfo->getRealPath()) === false) {
108+
return false;
109+
}
110+
} elseif (unlink($realpath) === false) {
110111
return false;
111112
}
112113
}
114+
else{
115+
return false;
116+
}
113117
}
114118

115119
if ($removeOnlyChildren === false) {
@@ -148,4 +152,4 @@ public static function getAbsolutePath(string $path): string
148152
$prefix = $__FILE__[0] === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '';
149153
return $prefix . implode(DIRECTORY_SEPARATOR, $absolutes);
150154
}
151-
}
155+
}

0 commit comments

Comments
 (0)