From 2ac65955a3063b12617e66629da7db733a27136a Mon Sep 17 00:00:00 2001 From: Joel T Date: Wed, 11 May 2022 15:59:49 -0700 Subject: [PATCH] Supressing warnings originating from metadata functions --- plugins/woocommerce/includes/wc-rest-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce/includes/wc-rest-functions.php b/plugins/woocommerce/includes/wc-rest-functions.php index 3337c071b40..9eed8f4ed49 100644 --- a/plugins/woocommerce/includes/wc-rest-functions.php +++ b/plugins/woocommerce/includes/wc-rest-functions.php @@ -139,7 +139,7 @@ function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) { include_once ABSPATH . 'wp-admin/includes/image.php'; } - $image_meta = wp_read_image_metadata( $upload['file'] ); + $image_meta = @wp_read_image_metadata( $upload['file'] ); if ( $image_meta ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { $title = wc_clean( $image_meta['title'] ); @@ -159,7 +159,7 @@ function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) { $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $id ); if ( ! is_wp_error( $attachment_id ) ) { - wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) ); + @wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) ); } return $attachment_id;