Opened 11 years ago
Closed 11 years ago
#24577 closed defect (bug) (fixed)
Undefined index notice caused by default-widgets.php - WP_Widget_Recent_Posts
Reported by: | jrf | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | Widgets | Keywords: | has-patch |
Focuses: | Cc: |
Description
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 ;-)
Attachments (1)
Change History (3)
#1
@
11 years ago
- Milestone changed from Awaiting Review to 3.6
- Version changed from trunk to 3.5
Confirmed with WP_DEBUG_LOG
enabled. Introduced in [21935].
We currently handle widget parameters inconsistently (some widgets use wp_parse_args()
, others isset()
and ! empty()
), but that can be fixed in a future release.
Note: See
TracTickets for help on using
tickets.
Unified patch file for wp-includes/default-widgets.php