WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 2 months ago

#24733 closed defect (bug) (fixed)

Unused code in WP_Widgets::update_callback()

Reported by: jdgrimes Owned by: SergeyBiryukov
Milestone: 3.9 Priority: normal
Severity: minor Version:
Component: Widgets Keywords: good-first-bug has-patch
Focuses: Cc:

Description

The single argument for WP_Widgets::update_callback() ($widget_args) does not appear to have any usage in the function, except for the five references shown below, which alone don't seem to do anything.

if ( is_numeric($widget_args) )
       $widget_args = array( 'number' => $widget_args );
	
       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );

Attachments (1)

24733.diff (768 bytes) - added by OriginalEXE 2 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 ocean902 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.9

Hello jdgrimes, thanks for the report.

Yes, the code seems to be unused since it was introduced in [10798]. How bad.

comment:2 SergeyBiryukov2 months ago

The original code was introduced in [10764]. $widget_args was used in control_callback().

In [10798], control_callback() was renamed to update_callback(), and $widget_args usage was moved to form_callback().

So, yeah, unused since [10798].

comment:3 SergeyBiryukov2 months ago

  • Keywords good-first-bug added

comment:4 ircbot2 months ago

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.

OriginalEXE2 months ago

comment:5 OriginalEXE2 months ago

  • Keywords has-patch added; needs-patch removed

comment:6 SergeyBiryukov2 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 27224:

Remove unused code from WP_Widget::update_callback().

props OriginalEXE.
fixes #24733.

Note: See TracTickets for help on using tickets.