#14857 closed defect (bug) (duplicate)
Shortcode causes preceding HTML tag to disappear
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Shortcodes | Version: | 3.0.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
On my Wordpress 3.0.1 installation (Atahualpa theme 3.4.4, PHP 5.2.12 + Zend 2.2.0 running on SunOS 5.10) I've succesfully added a shortcode which allows me to 'write' an image into the text of a contribution; all the hard work of figuring out where it should be displayed, how wide the container should be, and what the caption looks like is handled by the shortcode callback function. It works very well, but for one weird issue.
If I use a HTML construct like
<p>[photo location="..." link="..."]Lorem ipsum dolor sit amet...
where [photo...] expands into a complex <span>, then on random occasions the shortcode processing will swallow the preceding <p> tag. If I didn't have specific CSS applied to distinguish between the appearance of various <a> tags in <p> text (which rely on very specific child selectors, amongst which the presence of an opening <p> tag) I would never have seen the problem. If I modify the HTML to
<p><!---->[photo location="..." link="..."]Lorem ipsum dolor sit amet...
which introduces a non-visible break between the <p> tag and the shortcode, then the <p> tag is left alone. Oddly enough, the comment is not removed either.
Unfortunately there seems to be no pattern to this 'gobbling up' of preceding tags; I only know it is there, and how to work around it. On a previous occasion (dealing with ticket #14468) I had been instructed to up the PCRE backtrack limit, but setting this at an in my opinion ridiculous value of 5000000 did not cause the problem to disappear. I can provide a visual demonstration of the problem if required.
Change History (5)
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
comment:3
in reply to:
↑ description
nacin — 3 years ago
Replying to cymric:
On a previous occasion (dealing with ticket #14468) I had been instructed to up the PCRE backtrack limit, but setting this at an in my opinion ridiculous value of 5000000 did not cause the problem to disappear.
Keep in mind it's just a number.
PHP 5.2 introduced a default of 100,000, but internally, PCRE's default limit is actually 10 million. (http://bugs.php.net/40846) It's really not much when you start dealing with complex expressions, a lot of content, or both.

This is a separate issue from backtracking limits. Duplicate of #10082.