Make WordPress Core

Opened 9 years ago

Closed 9 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:


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 9 years ago.

Download all attachments as: .zip

Change History (3)

9 years ago

#1 @SergeyBiryukov
9 years ago

  • Milestone changed from Awaiting Review to 4.2

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

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