[wp-trac] [WordPress Trac] #14857: Shortcode causes preceding HTML tag to disappear
WordPress Trac
wp-trac at lists.automattic.com
Sun Sep 12 22:23:55 UTC 2010
#14857: Shortcode causes preceding HTML tag to disappear
--------------------------+-------------------------------------------------
Reporter: cymric | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Shortcodes | Version: 3.0.1
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14857>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list