Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22824 closed defect (bug) (fixed)

multi_resize can cause fatal if individual _save(s) fail

Reported by: dh-shredder's profile dh-shredder Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: critical Version: 3.5
Component: Media Keywords: has-patch
Focuses: Cc:

Description

multi_resize is not properly checking for WP_Error after a save before dereferencing the metadata returned from _save(). This can cause a fatal error (due to dereferencing a WP_Error) if one of the individual saves fails.

This is a regression to the previous behavior in 3.4.2

Patch attached fixes this by moving the array access/unset into the ! is_wp_error() check.

Attachments (1)

22824.diff (1.2 KB) - added by dh-shredder 11 years ago.

Download all attachments as: .zip

Change History (6)

@dh-shredder
11 years ago

#1 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.5
  • Severity changed from major to critical

#2 @markoheijnen
11 years ago

Looked and tested the patch and it's good

#3 @dh-shredder
11 years ago

  • Cc dh-shredder added

We could also get rid of the && $resized, since we're guaranteed to receive either an array or WP_Error from _save() in both classes, but left it the way it was to avoid additional logic churn.

#4 @nacin
11 years ago

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

In 23133:

Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.

#5 @nacin
11 years ago

In 23136:

Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.

Merges [23133] to the 3.5 branch.

Note: See TracTickets for help on using tickets.