From c1d2b0991811cdf4d36f1c609c81c982a0ea7224 Mon Sep 17 00:00:00 2001 From: djfm Date: Fri, 25 Sep 2015 16:52:30 +0200 Subject: [PATCH] // cleaner way to suppress the notice --- blocktopmenu.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/blocktopmenu.php b/blocktopmenu.php index ced55bb..41150a3 100644 --- a/blocktopmenu.php +++ b/blocktopmenu.php @@ -958,7 +958,12 @@ class Blocktopmenu extends Module implements WidgetInterface protected function clearMenuCache() { $dir = $this->getCacheDirectory(); - foreach (@scandir($dir) as $entry) { + + if (!is_dir($dir)) { + return; + } + + foreach (scandir($dir) as $entry) { if (preg_match('/\.json$/', $entry)) { unlink($dir . DIRECTORY_SEPARATOR . $entry); }