Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#30472 closed defect (bug) (fixed)

get_terms_to_edit() can return a WP_Error, but used as a string

Reported by: dd32 Owned by: wonderboymusic
Priority: normal Milestone: 4.4
Component: Taxonomy Version:
Severity: normal Keywords: has-patch
Cc: Focuses: administration

Description

As noted in #28319 get_terms_to_edit() can return string|bool|WP_Error, but in a number of places we simply treat it as a string, causing a PHP Fatal.

Attachments (1)

30472.diff (2.2 KB ) - added by valendesigns 12 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
12 years ago

  • Component AdministrationTaxonomy
  • Focuses administration added; template removed

@valendesigns
12 years ago

#2 @valendesigns
12 years ago

  • Keywords has-patch reporter-feedback added; needs-patch removed

This patch should stop fatal PHP errors from being thrown when the value of get_terms_to_edit() is a WP_Error or boolean.

@dd32 could you please provide some information on how you caused the error in the first place so I can properly test the patch and also write unit tests if needed.

Cheers,
Derek

#3 @wonderboymusic
11 years ago

  • Keywords reporter-feedback removed
  • Milestone Future Release4.4

#4 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolutionfixed
  • Status newclosed

In 35139:

Taxonomy: get_terms_to_edit() can also return false or WP_Error. Vars using it should be set to empty string when errors are returned to avoid producing fatal errors when used in string operations.

Props valendesigns.
Fixes #30472.

Note: See TracTickets for help on using tickets.