Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#17736 closed defect (bug) (fixed)

Undefined Index in image-edit.php

Reported by: miqrogroove's profile miqrogroove Owned by: wonderboymusic's profile 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 13 years ago.
17736.2.diff (615 bytes) - added by MikeHansenMe 12 years ago.
refreshed patch

Download all attachments as: .zip

Change History (10)

#1 @miqrogroove
13 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.

#2 @SergeyBiryukov
13 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.

#3 @dimitrov.adrian
13 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.

#4 @goto10
12 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.

@MikeHansenMe
12 years ago

refreshed patch

#6 @kirasong
11 years ago

  • Milestone changed from Awaiting Review to Future Release

#7 @wonderboymusic
10 years 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.

#8 @wonderboymusic
10 years ago

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