From 83f5ab5c79b2603b8861ad312ba780f1cb3b0c1e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 12 Aug 2023 09:00:57 +0300 Subject: [PATCH] fix basename() being passed a NULL value --- classes/diskcache.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/diskcache.php b/classes/diskcache.php index 6a9038289..b5c10e89d 100644 --- a/classes/diskcache.php +++ b/classes/diskcache.php @@ -243,8 +243,9 @@ class DiskCache implements Cache_Adapter { 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 { - return $this->adapter->is_writable(basename($filename)); + return $this->adapter->is_writable($filename ? basename($filename) : null); } public function exists(string $filename): bool {