From fccb285ce442c710d9795d2a102b229799de4922 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 26 Jul 2015 08:08:23 +0200 Subject: [PATCH] allow pear to work when cache_dir is not writable --- PEAR/REST.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PEAR/REST.php b/PEAR/REST.php index c5ed192..1e472b7 100644 --- a/PEAR/REST.php +++ b/PEAR/REST.php @@ -235,6 +235,13 @@ function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid = } } + if (!is_writeable($cache_dir)) { + // If writing to the cache dir is not going to work, silently do nothing. + // An ugly hack, but retains compat with PEAR 1.9.1 where many commands + // work fine as non-root user (w/out write access to default cache dir). + return true; + } + if ($cacheid === null && $nochange) { $cacheid = unserialize(implode('', file($cacheidfile))); }