WordPress.org

Make WordPress Core

Opened 7 weeks ago

Closed 3 weeks ago

Last modified 3 weeks 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:
PR Number:

Description

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 7 weeks ago.

Download all attachments as: .zip

Change History (5)

@johnbillion
7 weeks ago

#1 @johnbillion
7 weeks ago

  • Keywords has-patch added; needs-patch removed

#2 @johnbillion
7 weeks ago

  • Milestone changed from Awaiting Review to 5.3

#3 @johnbillion
3 weeks 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
3 weeks ago

In 46266:

Coding Standards: Fix WPCS issue in [46262].

See #47952.

Note: See TracTickets for help on using tickets.