Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#31954 closed defect (bug) (fixed)

`wp_update_term()` doesn't check for `null` after `get_term()`

Reported by: dlh's profile dlh Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

get_term() can return null, but wp_update_term() checks $term for only a WP_Error before proceeding as if it has an array. This can lead to a warning in array_merge($term, $args) and a notice in wp_unslash( $args['name'] ).

The attached patch adds a check for null and a unit test.

Attachments (1)

31954.patch (1.0 KB) - added by dlh 10 years ago.

Download all attachments as: .zip

Change History (3)

@dlh
10 years ago

#1 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.2

We could use an existing string, 'Empty Term' (upper case).

#2 @SergeyBiryukov
10 years ago

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

In 32117:

wp_update_term() should check if get_term() returned null.

props dlh.
fixes #31954.

Note: See TracTickets for help on using tickets.