From 2e50c871ab07f2420851df987020d02dea2cb17d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 28 Oct 2013 16:42:36 +0000 Subject: [PATCH] Avoid a PHP warning in wp_generate_attachment_metadata() if $metadata is not an array. props asakurayoh. fixes #25649. git-svn-id: https://develop.svn.wordpress.org/trunk@25968 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/image.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index f2e636bbb8..61f527a569 100644 --- a/src/wp-admin/includes/image.php +++ b/src/wp-admin/includes/image.php @@ -150,8 +150,10 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) { update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id ); } } + // remove the blob of binary data from the array - unset( $metadata['image']['data'] ); + if ( isset( $metadata['image']['data'] ) ) + unset( $metadata['image']['data'] ); return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id ); }