Opened 17 years ago
Closed 17 years ago
#4809 closed defect (bug) (fixed)
Returning WP_Error objects in unexpected places
Reported by: | filosofo | Owned by: | filosofo |
---|---|---|---|
Milestone: | 2.5 | Priority: | high |
Severity: | major | Version: | 2.3 |
Component: | General | Keywords: | wp_error |
Focuses: | Cc: |
Description
All of the functions listed below return WP_Error objects if something goes wrong. The problem is that in most of the many places where these functions appear throughout the WordPress codebase, whatever has called them is not expecting to get a WP_Error object.
So what happens is that you get a fatal error along the lines of "Fatal error: Cannot use object of type WP_Error as array in . . ." instead of the kind of helpful error handling WP_Error is supposed to provide.
I would like to use this ticket to create patches to address each of the areas where this occurs.
Functions that return WP_Error objects
(those marked with * have received the WP_Error object from elsewhere)
*get_bookmark_field
get_objects_in_term
*get_post_field
get_term
get_term_children
*get_term_field
*get_term_to_edit
get_terms
wp_get_object_terms
wp_insert_term
wp_set_object_terms
wp_update_term
wp_write_post
I've been working on this, but it's very involved--a wp error potentially gets returned in dozens of places. Would it be better to post one big patch or piecemeal as I'm doing it?