Skip to content

Commit a2309e6

Browse files
committed
fix: add fallbacks for realpath() so VFS is supported
1 parent 59c79d9 commit a2309e6

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

system/Publisher/Publisher.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ final public function getScratch(): string
229229
if ($this->scratch === null) {
230230
$this->scratch = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . bin2hex(random_bytes(6)) . DIRECTORY_SEPARATOR;
231231
mkdir($this->scratch, 0700);
232-
$this->scratch = realpath($this->scratch) . DIRECTORY_SEPARATOR;
232+
$this->scratch = realpath($this->scratch) ? realpath($this->scratch) . DIRECTORY_SEPARATOR
233+
: $this->scratch . DIRECTORY_SEPARATOR;
233234
}
234235

235236
return $this->scratch;

tests/system/Publisher/PublisherSupportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function testWipe()
144144
{
145145
$directory = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . bin2hex(random_bytes(6));
146146
mkdir($directory, 0700);
147-
$directory = realpath($directory);
147+
$directory = realpath($directory) ?: $directory;
148148
$this->assertDirectoryExists($directory);
149149
config('Publisher')->restrictions[$directory] = ''; // Allow the directory
150150

0 commit comments

Comments
 (0)