WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 14 months ago

Last modified 14 months ago

#17736 closed defect (bug) (fixed)

Undefined Index in image-edit.php

Reported by: miqrogroove Owned by: wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.1.3
Component: Media Keywords: has-patch
Focuses: Cc:

Description

PHP Notice: Undefined index: thumbnail in wp-admin/includes/image-edit.php on line 649

			if ( $thumb = $meta['sizes']['thumbnail'] )

Attachments (2)

17736.patch (638 bytes) - added by SergeyBiryukov 4 years ago.
17736.2.diff (615 bytes) - added by MikeHansenMe 3 years ago.
refreshed patch

Download all attachments as: .zip

Change History (10)

comment:1 @miqrogroove4 years ago

I used the "scale image" option to change an image from 256x300 to a height of 150 and whatever the default width was. After doing so, there was no thumbnail and the editor started bugging out on me. I think that's when the notices were logged.

@SergeyBiryukov4 years ago

comment:2 @SergeyBiryukov4 years ago

  • Keywords has-patch added

A !empty() check probably wouldn't hurt.

I couldn't reproduce the issue though. The notice means that there's no thumbnail for the image, while "Thumbnail Settings" block with target selection is only displayed when the thumbnail is present.

Perhaps the image metadata was malformed? In that case, the issue might be deeper.

comment:3 @dimitrov.adrian3 years ago

I tried and reproduced such problem (on wordpress daily build) when i moving a website from one host to other, but the interesting is that i just copy the databases, not using the importer/exporter plugins.

comment:4 @goto103 years ago

  • Cc dromsey@… added

I ran into the same issue. Sergey's fix worked for me. I did some debugging and noticed that the sizes element was set to an empty array. (I saved $meta to a row in the options table, since I wasn't sure how else to see the value, being that we're in ajax mode at this point during execution). Unfortunately, I'm not sure why the sizes are all gone.

@MikeHansenMe3 years ago

refreshed patch

comment:6 @DH-Shredder18 months ago

  • Milestone changed from Awaiting Review to Future Release

comment:7 @wonderboymusic14 months ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28366:

Avoid a notice in wp_save_image() by checking $meta['sizes']['thumbnail'] for ! empty() before setting a variable to it.

Props MikeHansenMe.
Fixes #17736.

comment:8 @wonderboymusic14 months ago

  • Milestone changed from Future Release to 4.0
Note: See TracTickets for help on using tickets.