Skip to content

Commit 359ddb1

Browse files
committed
Helper::purge() protection (#392)
1 parent 025d1ce commit 359ddb1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Framework/Helpers.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class Helpers
2020
*/
2121
public static function purge(string $dir): void
2222
{
23+
if (preg_match('#^(\w:)?[/\\\\]?$#', $dir)) {
24+
throw new \InvalidArgumentException('Directory must not be an empty string or root path.');
25+
}
2326
if (!is_dir($dir)) {
2427
mkdir($dir);
2528
}

0 commit comments

Comments
 (0)