Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#47952 closed defect (bug) (fixed)

create_and_get() doesn't consider that create() can return a WP_Error

Reported by: johnbillion Owned by: johnbillion
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:


The create_and_get() methods in the test suite don't check the return value of the create() method. It can return a WP_Error, for example when attempting to create a term in a taxonomy that doesn't exist, which causes PHP errors when subsequently attempting to get the object.

Attachments (1)

47952.diff (1.4 KB) - added by johnbillion 11 months ago.

Download all attachments as: .zip

Change History (5)

11 months ago

#1 @johnbillion
11 months ago

  • Keywords has-patch added; needs-patch removed

#2 @johnbillion
11 months ago

  • Milestone changed from Awaiting Review to 5.3

#3 @johnbillion
11 months ago

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

In 46262:

Build/Test tools: Ensure the create_and_get() factory method returns the appropriate WP_Error when creating a term fails.

Fixes: #47952

#4 @SergeyBiryukov
11 months ago

In 46266:

Coding Standards: Fix WPCS issue in [46262].

See #47952.

Note: See TracTickets for help on using tickets.