[wp-trac] [WordPress Trac] #34814: Presence of "Less than sign" < adds additional closing shortcode tag.

WordPress Trac noreply at wordpress.org
Tue Dec 1 07:25:17 UTC 2015


#34814: Presence of "Less than sign" < adds additional closing shortcode tag.
-------------------------------+------------------------------
 Reporter:  alexander.rohmann  |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Shortcodes         |     Version:  4.2.3
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> If a `<` is used in shortcode content without a reciprocating `>` the
> shortcode closing tag will be duplicated. This was introduced in 4.2.3 as
> part of [https://core.trac.wordpress.org/changeset/33360/]
>
> For example, assuming `[my_shortcode]` simply returns it's content.
> This...
> `[my_shortcode]One < Two[/my_shortcode]`
>
> Should output this:
> `One < Two`
>
> But instead, we get this:
>
> `One < Two[/my_shortcode]`
>
> Consequently, a unit test somewhat like this won't pass:
>
> {{{
> array(
>     '[caption]Hello < World[/caption]',
>     'Hello < World'
> )
> }}}
>

> I'm not 100% sure, but I suspect it's due to this regex:
> https://core.trac.wordpress.org/browser/branches/4.2/src/wp-
> includes/shortcodes.php?rev=33360#L346
>
> By continuing to match all input, perhaps that also grabs the shortcode's
> closing tag, causing it to be duplicated.

New description:

 If a `<` is used in shortcode content without a reciprocating `>` the
 shortcode closing tag will be duplicated. This was introduced in 4.2.3 as
 part of [33360].

 For example, assuming `[my_shortcode]` simply returns it's content.
 This...
 `[my_shortcode]One < Two[/my_shortcode]`

 Should output this:
 `One < Two`

 But instead, we get this:

 `One < Two[/my_shortcode]`

 Consequently, a unit test somewhat like this won't pass:

 {{{
 array(
     '[caption]Hello < World[/caption]',
     'Hello < World'
 )
 }}}


 I'm not 100% sure, but I suspect it's due to this regex:
 https://core.trac.wordpress.org/browser/branches/4.2/src/wp-
 includes/shortcodes.php?rev=33360#L346

 By continuing to match all input, perhaps that also grabs the shortcode's
 closing tag, causing it to be duplicated.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34814#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list