Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#21572 closed defect (bug) (invalid)

Unnecessary function argument for display_rows

Reported by: cojennin's profile cojennin Owned by:
Milestone: Priority: normal
Severity: trivial Version:
Component: Administration Keywords:
Focuses: Cc:

Description

display_rows($posts = array()) in /wp-admin/includes/class-wp-posts-list-table.php (line 303) overrides display_rows() in /wp-admin/includes/class-wp-list-table.php (line 807).

display_rows($posts = array()) never uses the $posts argument because $posts is assigned $wp_query->posts later on in the function.

This argument and the if(empty($posts)) check later in the function are extraneous.

Attachments (1)

class-wp-posts-list-table.php (578 bytes) - added by cojennin 13 years ago.
removed function argument and empty check

Download all attachments as: .zip

Change History (4)

@cojennin
13 years ago

removed function argument and empty check

#1 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.5

The $level = 0 parameter is also useless, yes? We add an argument to a method we override but never use it. This is likely confusion stemming from _display_rows().

Patch looks good otherwise. If uploaded with a diff or patch extension, it will be color-coded here on Trac.

#2 @wonderboymusic
13 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Line 1368 of ajax-actions.php:

$wp_list_table = _get_list_table('WP_Posts_List_Table');

$level gets set, and then....

Line 1382 of ajax-actions.php:

$wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );

Uses both arguments... so, the patch would break that...

#3 @SergeyBiryukov
13 years ago

  • Component changed from General to Administration
  • Milestone 3.5 deleted
Note: See TracTickets for help on using tickets.