[wp-trac] [WordPress Trac] #24577: Undefined index notice caused by default-widgets.php - WP_Widget_Recent_Posts

WordPress Trac noreply at wordpress.org
Fri Jun 14 16:34:13 UTC 2013


#24577: Undefined index notice caused by default-widgets.php -
WP_Widget_Recent_Posts
--------------------------+-----------------------------
 Reporter:  jrf           |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 When updating the Recent Posts widget, it can cause an undefined index
 notice:
 {{{
 [14-Jun-2013 04:56:40] Backtrace from warning 'Undefined index: show_date'
 at /www/wp-includes/default-widgets.php 596:
         /www/wp-includes/widgets.php 232 calling update()
         <unknown file> <unknown line> calling update_callback()
         /www/wp-admin/includes/ajax-actions.php 1562 calling
 call_user_func_array()
         <unknown file> <unknown line> calling wp_ajax_save_widget()
         /www/wp-includes/plugin.php 406 calling call_user_func_array()
         /www/wp-admin/admin-ajax.php 72 calling do_action()
 }}}

 To fix, line 599 (based on current trunk):
 {{{
 $instance['show_date'] = (bool) $new_instance['show_date'];
 }}}
 would need to be replaced with:
 {{{
 $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool)
 $new_instance['show_date'] : false;
 }}}

 Patch file included.

 Hope this helps ;-)

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


More information about the wp-trac mailing list