[wp-trac] [WordPress Trac] #11737: PHP Notice in get_cat_name()

WordPress Trac wp-trac at lists.automattic.com
Wed Jan 6 07:09:48 UTC 2010


#11737: PHP Notice in get_cat_name()
------------------------------+---------------------------------------------
 Reporter:  miqrogroove       |       Owner:  westi
     Type:  defect (bug)      |      Status:  new  
 Priority:  normal            |   Milestone:  3.0  
Component:  Warnings/Notices  |     Version:       
 Severity:  normal            |    Keywords:       
------------------------------+---------------------------------------------

Comment(by nacin):

 Quick fix:
 get_cat_name() should probably check to see if get_category() returns a
 wp_error, and if so, return '' (instead of returning ->name for a
 WP_Error). I'd suggest it passes along the error, but really, if you're
 asking for the cat name and the cat doesn't exist, you should get an empty
 string.

 Real fix:
 Like in wp-admin/comment.php for comments, wp-admin/categories.php should
 always first check if the category is legit before doing stuff to it. That
 would be something like {{{ if( is_wp_error( get_category($cat_ID) ) )
 wp_die('No category with this ID.'); }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11737#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list