WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#33025 closed defect (bug) (fixed)

Invalid argument in class-wp-posts-list-table.php

Reported by: newkind Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.2.2
Component: Posts, Post Types Keywords: has-patch commit
Focuses: administration Cc:
PR Number:

Description

HI,

In the file :

wp-admin/includes/class-wp-posts-list-table.php

there's a variable $post_formats set to :

$post_formats = get_theme_support( 'post-formats' );

and right below it there's a loop which causes Warnings when $post_formats doesn't return array
of arguments but boolean :

foreach ( $post_formats[0] as $format ) {

WP should check if $post_formats is array so we wouldn't end up with Invalid Arguments Supplied warning.

Thanks!

Attachments (1)

33025.diff (945 bytes) - added by DrewAPicture 4 years ago.

Download all attachments as: .zip

Change History (3)

@DrewAPicture
4 years ago

#1 @DrewAPicture
4 years ago

  • Component changed from Administration to Posts, Post Types
  • Focuses administration added
  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 4.4

33025.diff adds an is_array() check consistent with other areas in core.

Last edited 4 years ago by DrewAPicture (previous) (diff)

#2 @wonderboymusic
4 years ago

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

In 33667:

In WP_Posts_List_Table::inline_edit(), check that $post_formats[0] is an array before traversing.

Props DrewAPicture.
Fixes #33025.

Note: See TracTickets for help on using tickets.