Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#17938 closed defect (bug) (fixed)

Prevent fatal errors caused by admin-ajax.php's use of wp_insert_term()

Reported by: mdawaffe's profile mdawaffe Owned by: westi's profile westi
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.2
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

wp_insert_term() can return a WP_Error, but admin-ajax.php does not catch these errors. In two places (when adding post and link categories during post/link creation), the result of wp_insert_term() is blindly assumed to be an array, which will cause a fatal error.

Attached checks for errors and skips that category. The patch does not implement any error messaging to the user.

See also #17936.

Attachments (1)

17938.diff (807 bytes) - added by mdawaffe 14 years ago.

Download all attachments as: .zip

Change History (5)

@mdawaffe
14 years ago

#1 @mdawaffe
14 years ago

#17939 is related, and has a comprehensive patch for both of the issues.

#2 @westi
14 years ago

  • Owner set to westi
  • Status changed from new to accepted

#3 @ryan
13 years ago

  • Milestone changed from Awaiting Review to 3.4

#4 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In [19792]:

Check the return of wp_insert_term() for WP_Error or array. Prevents fatal erros and failure to add categories when adding terms via ajax. Props mdawaffe. fixes #17938 #17939

Note: See TracTickets for help on using tickets.