File tree Expand file tree Collapse file tree
src/Console/Command/Static Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -267,7 +267,11 @@ private function removeDirectory(string $dir): bool
267267 return false ;
268268 }
269269
270- // Check if directory is writable
270+ // Check if directory is readable and writable
271+ if (!is_readable ($ dir )) {
272+ throw new \RuntimeException (sprintf ('Directory is not readable: %s ' , $ dir ));
273+ }
274+
271275 if (!is_writable ($ dir )) {
272276 throw new \RuntimeException (sprintf ('Directory is not writable: %s ' , $ dir ));
273277 }
@@ -299,9 +303,12 @@ private function removeDirectory(string $dir): bool
299303 if (!is_writable ($ path )) {
300304 throw new \RuntimeException (sprintf ('File is not writable: %s ' , $ path ));
301305 }
302- // Re-check file exists before unlinking
303- if (file_exists ($ path ) && !unlink ($ path )) {
304- throw new \RuntimeException (sprintf ('Failed to remove file: %s ' , $ path ));
306+ // Unlink directly - it will return false if file doesn't exist
307+ if (!unlink ($ path )) {
308+ // Only throw if file still exists (not a race condition)
309+ if (file_exists ($ path )) {
310+ throw new \RuntimeException (sprintf ('Failed to remove file: %s ' , $ path ));
311+ }
305312 }
306313 }
307314 }
You can’t perform that action at this time.
0 commit comments