fix basename() being passed a NULL value

This commit is contained in:
Andrew Dolgov 2023-08-12 09:00:57 +03:00
parent adba0aa8d2
commit 83f5ab5c79
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
1 changed files with 2 additions and 1 deletions

View File

@ -243,8 +243,9 @@ class DiskCache implements Cache_Adapter {
return $this->adapter->make_dir(); return $this->adapter->make_dir();
} }
/** @param string|null $filename null means check that cache directory itself is writable */
public function is_writable(?string $filename = null): bool { public function is_writable(?string $filename = null): bool {
return $this->adapter->is_writable(basename($filename)); return $this->adapter->is_writable($filename ? basename($filename) : null);
} }
public function exists(string $filename): bool { public function exists(string $filename): bool {