WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#35486 closed defect (bug) (fixed)

Pass `$post` to `post_password_required()` in `get_the_excerpt()`

Reported by: sebastian.pisula Owned by: swissspidy
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Two fix in get_the_excerpt function:

  1. in docs param $post can be int|WP_Post and null
  2. post_password_required function should have $post param

Attachments (2)

35486.patch (909 bytes) - added by sebastian.pisula 4 years ago.
35486.diff (1.4 KB) - added by swissspidy 4 years ago.

Download all attachments as: .zip

Change History (5)

#1 @swissspidy
4 years ago

  • Component changed from General to Posts, Post Types
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.5

int|WP_Post|null is used like two or three times throughout the code base, whereas int|WP_Post is used everywhere else. null is the default value and IMHO already covered by int|WP_Post.

The post_password_required() part is a bad oversight though.

@swissspidy
4 years ago

#2 @swissspidy
4 years ago

  • Keywords has-patch has-unit-tests added; needs-patch removed
  • Owner set to swissspidy
  • Status changed from new to reviewing
  • Summary changed from Fix in get_the_excerpt to Pass `$post` to `post_password_required()` in `get_the_excerpt()`

#3 @swissspidy
4 years ago

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

In 36329:

Posts: Correctly pass $post to post_password_required() in get_the_excerpt().

Corrects the relevant test.

Props sebastian.pisula for initial patch.
Fixes #35486.

Note: See TracTickets for help on using tickets.