We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 004c9de commit f304a0aCopy full SHA for f304a0a
cleanup.php
@@ -27,14 +27,19 @@
27
28
function removeDirectory(string $dir): bool
29
{
30
- if (! is_dir($dir)) {
+ if (!is_dir($dir)) {
31
return false;
32
}
33
34
$files = array_diff(scandir($dir), ['.', '..']);
35
36
foreach ($files as $file) {
37
- $path = $dir.DIRECTORY_SEPARATOR.$file;
+ $path = realpath($dir . DIRECTORY_SEPARATOR . $file);
38
+
39
+ // Als realpath faalt (bv. bestand is al weg), sla over
40
+ if ($path === false) {
41
+ continue;
42
+ }
43
44
if (is_dir($path)) {
45
removeDirectory($path);
@@ -45,3 +50,4 @@ function removeDirectory(string $dir): bool
50
46
51
return rmdir($dir);
47
52
53
0 commit comments