Make WordPress Core

Ticket #35959: 2016-02-25--01--patch--relay-editor-error.txt

File 2016-02-25--01--patch--relay-editor-error.txt, 866 bytes (added by maratbn, 8 years ago)

Attaching patch to mitigate this problem.

Line 
1--- ./wp-admin/includes/image.php--BACKUP--2016-02-25--01       2016-02-25 20:04:29.204726000 -0800
2+++ ./wp-admin/includes/image.php       2016-02-25 20:30:36.872726000 -0800
3@@ -71,7 +71,7 @@
4  *
5  * @param int $attachment_id Attachment Id to process.
6  * @param string $file Filepath of the Attached image.
7- * @return mixed Metadata for attachment.
8+ * @return mixed Metadata for attachment or WP_Error on failure.
9  */
10 function wp_generate_attachment_metadata( $attachment_id, $file ) {
11        $attachment = get_post( $attachment_id );
12@@ -119,9 +119,9 @@
13 
14                if ( $sizes ) {
15                        $editor = wp_get_image_editor( $file );
16+                       if ( is_wp_error( $editor ) ) return $editor;
17 
18-                       if ( ! is_wp_error( $editor ) )
19-                               $metadata['sizes'] = $editor->multi_resize( $sizes );
20+                       $metadata['sizes'] = $editor->multi_resize( $sizes );
21                } else {
22                        $metadata['sizes'] = array();
23                }