WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#10326 closed defect (bug) (fixed)

strip_shortcodes() greedily strips surrounding bytes

Reported by: markjaquith Owned by: markjaquith
Milestone: 2.9 Priority: high
Severity: critical Version: 2.8
Component: Shortcodes Keywords: has-patch needs-testing
Focuses: Cc:

Description

strip_shortcodes() which is run on excerpts is too greedy.

Input:

before[gallery]after

Output:

beforfter

As you can see, the characters immediately preceding and following the shortcode have been stripped out. These characters should be preserved.

Attachments (1)

10326.001.diff (751 bytes) - added by markjaquith 6 years ago.

Download all attachments as: .zip

Change History (7)

@markjaquith6 years ago

comment:1 @markjaquith6 years ago

  • Keywords has-patch needs-testing added
  • Owner set to markjaquith
  • Status changed from new to accepted

Patch uploaded. Return the 1st and 6th matches, like do_shortcode_tag() does. Works for me. Can I get someone to verify?

comment:3 @westi5 years ago

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

comment:5 @miqrogroove5 years ago

  • Severity changed from major to critical

Increase severity because this bug is causing UTF-8 corruption and Google was rejecting my feeds until I applied this patch.

comment:6 @miqrogroove5 years ago

  • Summary changed from strip_shortcodes() greedily strips surrounding characters to strip_shortcodes() greedily strips surrounding bytes
Note: See TracTickets for help on using tickets.