Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#17581 closed defect (bug) (invalid)

3.1.3 SERIOUS shortcode handling problem with content

Reported by: wpweaver Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1.3
Component: Shortcodes Keywords:
Focuses: Cc:


Handling of the content string passed to shortcode handlers seems to be seriously broken in 3.1.3.

Symptoms: When the shortcode content spans multiple lines (as displayed in Visual editor):

more content

the content string passed to the shortcode handler is broken. Can't quite figure out how, but the parameter is not a correctly formed string. For example, most of the string functions simply don't work. Using substr($content,0,4), for example, yields a substring that is not 4 characters long. strpos won't find anything. I went back to pre-3.1.3, and everything worked as expected using identical plugin code and identical content in the page.

It seems okay when the content doesn't span multiple lines.

I've attached a demo shortcode. See the output source to see wacky stuff.

Attachments (1)

multi-line-bug.zip (1.1 KB) - added by wpweaver 7 years ago.
sample shortcode implementation to demo bug

Download all attachments as: .zip

Change History (6)

7 years ago

sample shortcode implementation to demo bug

#1 @wpweaver
7 years ago

The string you check needs to be long enough to demonstrate the problem - didn't put any error checking in the demo. Creating a source with <p> seems to generate most obvious errors, and if you add a strpos check for example, it will fail to find strings that really are in the content.

Last edited 7 years ago by wpweaver (previous) (diff)

#2 @dd32
7 years ago

I don't see anything wrong with the output in the 3.1 branch or in trunk.

What's the output you're seeing?

Here's the output I'm getting:

<!-- ######:text text<br />
  more text more text, probably needs
<p>&#8216;s<br />
  --><!--*** partial content (8 chars long?):text tex:*** --><strong>text tex</strong>

#3 @dd32
7 years ago

  • Keywords reporter-feedback added

#4 @wpweaver
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

My apologies. This is not a 3.1.3 bug, but rather a bug in the "PHP Shortcode" plugin. I thought I had disabled all my plugins, but missed that one. I was not using it, so apparently it affects the content, even if the shortcode is not being used.

I'm still pretty sure this did not show up until 3.1.3, but whatever, the problem is PHP Shortcode.

I will report the problem to the PHP Shortcode author.

#5 @ocean90
7 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Severity changed from critical to normal
Note: See TracTickets for help on using tickets.