From 1e4ab021d81743eaaab61fd732d1d5c701947a3d Mon Sep 17 00:00:00 2001 From: WordPressFan Date: Fri, 3 Jan 2025 16:45:47 +0200 Subject: [PATCH] guard against not having the fonts directory exist --- inc/Engine/Media/Fonts/Admin/Data.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/Engine/Media/Fonts/Admin/Data.php b/inc/Engine/Media/Fonts/Admin/Data.php index 585e0a563e..ddb47e3af8 100644 --- a/inc/Engine/Media/Fonts/Admin/Data.php +++ b/inc/Engine/Media/Fonts/Admin/Data.php @@ -7,6 +7,7 @@ use RecursiveIteratorIterator; use WP_Rocket\Admin\Options_Data; use WP_Rocket\Engine\Common\Queue\AbstractASQueue; +use Exception; class Data extends AbstractASQueue { /** @@ -72,7 +73,11 @@ public function collect_data() { return; } - $fonts = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->base_path . 'google-fonts/fonts/' ) ); + try { + $fonts = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->base_path . 'google-fonts/fonts/' ) ); + } catch ( Exception $exception ) { + return; + } $allowed_extensions = [ 'woff',