Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#10225 closed defect (bug) (fixed)

Various php notices in default-widgets.php

Reported by: mrmist's profile mrmist Owned by:
Milestone: 2.9 Priority: normal
Severity: minor Version: 2.9
Component: Warnings/Notices Keywords:
Focuses: Cc:

Description

The attached fixes various undefined index notices which appear when wp_debug is enabled and the widgets page is visited with various widgets and widget titles.

Attachments (1)

default-widgets.patch (2.8 KB) - added by mrmist 16 years ago.

Download all attachments as: .zip

Change History (10)

#1 @dd32
16 years ago

  • Component changed from General to Warnings/Notices

<?php checked(isset($instance['filter'])) ? $instance['filter'] : 0 ; ?>

That logic is wrong, Well, I mean the bracketing is.
Should be:

<?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?>

#2 @mrmist
16 years ago

Updated the patch as noted above..

#3 @dd32
16 years ago

  • Keywords commit added; widgets notice removed

#4 @Denis-de-Bernardy
16 years ago

nit picking, but things like this:

$count = isset($instance['count']) ? (bool) $instance['count'] :false; 

could also be written like:

$count = isset($instance['count']) && $instance['count']; 

#5 @Mittineague
16 years ago

I got an E_NOTICE with (with my version of a fix)

class WP_Widget_Search extends WP_Widget {
.....
	function widget( $args, $instance ) {
.....
//		$title = apply_filters('widget_title', $instance['title']);
		$title = apply_filters('widget_title', empty($instance['title']) ? __('Search') : $instance['title']);

And I haven't figured out how to fix this one yet

class WP_Widget_Text extends WP_Widget {
.....
	function widget( $args, $instance ) {

which has an index not defined for $instancefilter?

#6 @Mittineague
16 years ago

  • Cc Mittineague added

#7 @mrmist
16 years ago

Can this go in (with or without DdB's changes) before it gets stale?

#8 @Denis-de-Bernardy
16 years ago

r11757 fixed this, no?

#9 @mrmist
16 years ago

  • Keywords has-patch commit removed
  • Resolution set to fixed
  • Status changed from new to closed

This particular issue has indeed been fixed.

Note: See TracTickets for help on using tickets.