WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#19116 closed defect (bug) (fixed)

If post type "post" not exist

Reported by: djudorange Owned by: djudorange
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.2.1
Component: Database Keywords: has-patch needs-testing
Focuses: Cc:

Description

If the post type "post" is unregister, in users list page (in admin) ,
you have an error Mysql.

At line 4156 in wp-includes/post.php, the get_post_type_object() returns false (because the post type don't exist), the next "if" returns '1 = 0'.

But it missing the 'WHERE' before '1 = 0'.

It is possible to fix it by replacing the '1 = 0' to 'WHERE 1 = 0'

Attachments (1)

19116.diff (498 bytes) - added by duck_ 4 years ago.

Download all attachments as: .zip

Change History (4)

@duck_4 years ago

comment:1 @duck_4 years ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 3.3

Adds "WHERE" if $full is true.

comment:2 @nacin4 years ago

Looks good.

comment:3 @duck_4 years ago

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

In [19117]:

Return full WHERE clause from get_posts_by_author_sql() if the post type isn't registerd. Fixes SQL sytax on users list when 'post' is unregistered. Fixes #19116.

Note: See TracTickets for help on using tickets.