Opened 4 years ago

Closed 4 years ago

#10225 closed defect (bug) (fixed)

Various php notices in default-widgets.php

Reported by: mrmist Owned by:
Priority: normal Milestone: 2.9
Component: Warnings/Notices Version: 2.9
Severity: minor Keywords:
Cc: Mittineague

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 4 years ago.

Download all attachments as: .zip

Change History (10)

comment:1   dd324 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); ?>

mrmist4 years ago

Updated the patch as noted above..

comment:3   dd324 years ago

  • Keywords commit added; widgets notice removed

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']; 

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?

  • Cc Mittineague added

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

r11757 fixed this, no?

  • 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.