From 837fe4d6faa6f55b5eb69dae5c4eb22b31273640 Mon Sep 17 00:00:00 2001 From: discomrade Date: Thu, 3 Mar 2022 00:12:31 -0100 Subject: [PATCH] Check file exists before unlinking in 'file_unlink' --- inc/functions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 487b1c2c..bdbad810 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -795,12 +795,16 @@ function file_unlink($path) { $debug['unlink'][] = $path; } - $ret = @unlink($path); + if (file_exists($path)) { + $ret = @unlink($path); - if ($config['gzip_static']) { - $gzpath = "$path.gz"; + if ($config['gzip_static']) { + $gzpath = "$path.gz"; - @unlink($gzpath); + @unlink($gzpath); + } + } else { + $ret = false; } if (isset($config['purge']) && $path[0] != '/' && isset($_SERVER['HTTP_HOST'])) {