[wp-trac] [WordPress Trac] #47867: wp_trim_excerpt and wp_trim_words don't validate the excerpt length (int)

WordPress Trac noreply at wordpress.org
Tue Aug 13 08:52:53 UTC 2019


#47867: wp_trim_excerpt and wp_trim_words don't validate the excerpt length (int)
--------------------------------------+------------------------------
 Reporter:  pikamander2               |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  General                   |     Version:  5.2.2
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------
Changes (by donmhico):

 * keywords:   => has-patch has-unit-tests


Comment:

 @pikamander2 - Welcome in the trac. Congratulations and thank you for your
 very first ticket.

 I've attached a patched -
 [https://core.trac.wordpress.org/attachment/ticket/47867/47867.diff
 47867.diff] - that should fix your concern. However instead of using `0`
 as length for non-numeric `$num_words` passed to `wp_trim_words()` (e.g. '
 ', 'abc'), I think it's more reasonable to use the default `55` length.

 Also, I didn't apply the fix in `wp_trim_excerpt()` since it's ultimately
 uses `wp_trim_words()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47867#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list