WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#28872 closed defect (bug) (fixed)

Remove unused $check_urls and $description variables from wp-admin/includes/dashboard.php

Reported by: michalzuber Owned by: wonderboymusic
Milestone: 4.0 Priority: low
Severity: normal Version: 3.9
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

Variable $check_urls is passed by function param and the redefined version of it on line 833 isn't used.
URLs passed to the callback are from the function param $args = array_slice( func_get_args(), 2 );

The $description variable on line 1096 is not used afterwards.

Attachments (3)

28872.patch (1008 bytes) - added by michalzuber 6 years ago.
28872.2.diff (712 bytes) - added by michalzuber 6 years ago.
Replaced func_get_args()
28872.3.diff (672 bytes) - added by ocean90 6 years ago.

Download all attachments as: .zip

Change History (11)

@michalzuber
6 years ago

#1 @ocean90
6 years ago

In 29130:

Remove unused variable in wp_dashboard_plugins_output(). Unused since [26144].

props michalzuber.
see #28872.

#2 @ocean90
6 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.0
  • Priority changed from normal to low

Variable $check_urls

So func_get_args() ignores empty arguments and returns a copy of the passed arguments, means you can't override it. Has it ever worked?

#3 @michalzuber
6 years ago

  • Keywords needs-patch removed

#4 @wonderboymusic
6 years ago

$func = function ( $one, $two, $three = array() ) {
    $three = 3;
    print_r( func_get_args() );
};

$func( 1, 2 );

Results in:

Array
(
    [0] => 1
    [1] => 2
)

This never worked - that dashboard code is beyond bizarre

@michalzuber
6 years ago

Replaced func_get_args()

@ocean90
6 years ago

#5 @ocean90
6 years ago

  • Keywords has-patch commit added

#6 @michalzuber
6 years ago

@ocean90 what's wrong with 28872.2.diff ?
Isn't it a bit cleaner without array slicing and shifting? If I'm missing something, I apologize.

#7 @ocean90
6 years ago

@michalzuber It's possible to pass more arguments to wp_dashboard_cached_rss_widget(), these would be missing with 28872.2.diff.

I have no idea how wp_dashboard_cached_rss_widget() is used by others, but I prefer 28872.2.diff too.

#8 @wonderboymusic
6 years ago

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

In 29442:

wp_dashboard_cached_rss_widget() contained some func_get_args() code that was indescribably weird.
This keeps it weird, but makes sure that $check_urls gets passed to the callback.

Props michalzuber, ocean90.
Fixes #28872.

Note: See TracTickets for help on using tickets.