From ffa5d883ef44bd684db748a3e454071672913e48 Mon Sep 17 00:00:00 2001 From: Jason Coward Date: Thu, 25 Jan 2024 08:07:41 -0700 Subject: [PATCH] Validate Directory resource in xPDOCacheManager->deleteTree() (#255) --- src/xPDO/Cache/xPDOCacheManager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/xPDO/Cache/xPDOCacheManager.php b/src/xPDO/Cache/xPDOCacheManager.php index 3b7c79f8..7b6416a7 100644 --- a/src/xPDO/Cache/xPDOCacheManager.php +++ b/src/xPDO/Cache/xPDOCacheManager.php @@ -482,6 +482,9 @@ public function deleteTree($dirname, $options= array('deleteTop' => false, 'skip $handle= opendir($dirname); } $hasMore= false; + if (!is_resource($handle)) { + continue; + } while (false !== ($file= @ readdir($handle))) { if (is_array($excludeItems) && !empty($excludeItems) && in_array($file, $excludeItems)) continue; if (is_array($excludePatterns) && !empty($excludePatterns) && $this->matches($file, $excludePatterns)) continue;