Ticket #10326 (closed defect (bug): fixed)

Opened 7 months ago

Last modified 2 months ago

strip_shortcodes() greedily strips surrounding bytes

Reported by: markjaquith Owned by: markjaquith
Priority: high Milestone: 2.9
Component: Shortcodes Version: 2.8
Severity: critical Keywords: has-patch needs-testing
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

10326.001.diff Download (0.7 KB) - added by markjaquith 7 months ago.

Change History

  • 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?

westi3 months ago
  • status changed from accepted to closed
  • resolution set to fixed

westi3 months ago

I've added test cases for this to wordpress-tests

 http://svn.automattic.com/wordpress-tests/wp-testcase/test_shortcode.php

  • 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.

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