Make WordPress Core

Changeset 33565


Ignore:
Timestamp:
08/04/2015 07:17:11 AM (8 years ago)
Author:
dd32
Message:

Fix do_shortcode('<[shortcode]') edge case.
Props miqrogroove.

Merges [33499] to the 4.0 branch.
See #33116.

Location:
branches/4.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/wp-includes/shortcodes.php

    r33522 r33565  
    359359        $attributes = wp_kses_attr_parse( $element );
    360360        if ( false === $attributes ) {
     361            // Some plugins are doing things like [name] <[email]>.
     362            if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
     363                $element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
     364            }
     365
    361366            // Looks like we found some crazy unfiltered HTML.  Skipping it for sanity.
    362367            $element = strtr( $element, $trans );
  • branches/4.0/tests/phpunit/tests/shortcode.php

    r33381 r33565  
    428428            ),
    429429            array(
     430                '<[[gallery]]>',
     431                '<[gallery]>',
     432            ),
     433            array(
     434                '<div style="background:url([[gallery]])">',
     435                '<div style="background:url([[gallery]])">',
     436            ),
     437            array(
    430438                '[gallery]<div>Hello</div>[/gallery]',
    431439                '',
     
    464472                '<div [[gallery]]>', // Shortcodes will never be stripped inside elements.
    465473                '<div [[gallery]]>',
     474            ),
     475            array(
     476                '<[[gallery]]>',
     477                '<[[gallery]]>',
    466478            ),
    467479            array(
Note: See TracChangeset for help on using the changeset viewer.