[wp-trac] [WordPress Trac] #4809: Returning WP_Error objects in unexpected places

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 24 18:42:38 GMT 2007


#4809: Returning WP_Error objects in unexpected places
----------------------+-----------------------------------------------------
 Reporter:  filosofo  |       Owner:  anonymous
     Type:  defect    |      Status:  new      
 Priority:  normal    |   Milestone:  2.3      
Component:  General   |     Version:  2.3      
 Severity:  major     |    Keywords:  wp_error 
----------------------+-----------------------------------------------------
 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''' [[br]]
 (those marked with * have received the WP_Error object from elsewhere)
 ----------------------------------------------
 *get_bookmark_field [[br]]
 get_objects_in_term [[br]]
 *get_post_field [[br]]
 get_term [[br]]
 get_term_children [[br]]
 *get_term_field [[br]]
 *get_term_to_edit [[br]]
 get_terms [[br]]
 wp_get_object_terms [[br]]
 wp_insert_term [[br]]
 wp_set_object_terms [[br]]
 wp_update_term [[br]]
 wp_write_post [[br]]

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4809>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list