From 3cc8bcc86d6942375ca243beb2277e1e2cd6fa2e Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 14 Jun 2024 20:35:12 +0530 Subject: [PATCH] Fix/194 PHP Deprecated Warning --- safe-svg.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/safe-svg.php b/safe-svg.php index 2b6b1bc3..b43e990b 100644 --- a/safe-svg.php +++ b/safe-svg.php @@ -699,6 +699,10 @@ protected function svg_dimensions( $attachment_id ) { */ public function disable_srcset( $image_meta, $size_array, $image_src, $attachment_id ) { if ( $attachment_id && 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) { + // Convert to array if not already to avoid PHP warnings. + if ( ! is_array( $image_meta ) ) { + $image_meta = array(); + } $image_meta['sizes'] = array(); }