WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 5 months ago

#52820 reviewing defect (bug)

Possible logic error in wp_trim_excerpt()

Reported by: theMikeD Owned by: SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

https://core.trac.wordpress.org/browser/tags/5.7/src/wp-includes/formatting.php#L3845

Reading this code, it looks like the wp_trim_excerpt filter's $raw_excerpt parameter will be empty if $text as supplied to the function is empty. This should be the value of $text at L3824 should it not? Or do I mis-understand?

Change History (4)

This ticket was mentioned in PR #1126 on WordPress/wordpress-develop by donmhico.


7 months ago

  • Keywords has-patch has-unit-tests added

This PR assigns the correct value for $raw_excerpt if the passed $text is empty. Right now $raw_excerpt is empty if $text is empty.

Trac ticket: https://core.trac.wordpress.org/ticket/52820

#2 @donmhico
7 months ago

Hello @theMikeD. Thanks for the ticket. Yes, I believe you're correct. $raw_excerpt passed to wp_trim_excerpt filter is empty if $text is empty. In my PR above, I placed $raw_excerpt = $text; below the apply_filter( 'the_content' ) because I still believe that $raw_excerpt should be processed by that filter. Others can chime in their thoughts regarding this.

#3 @SergeyBiryukov
7 months ago

  • Component changed from General to Posts, Post Types
  • Milestone changed from Awaiting Review to 5.8
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @hellofromTonya
5 months ago

  • Milestone changed from 5.8 to 5.9

Today is 5.8 Beta 1. Ran out of time for this one to land. Punting to 5.9.

Note: See TracTickets for help on using tickets.