WordPress.org

Make WordPress Core

Changeset 33594


Ignore:
Timestamp:
08/07/2015 02:49:31 AM (6 years ago)
Author:
dd32
Message:

Fix do_shortcode('<[shortcode]') edge case.
Props miqrogroove.
Merges [33499] trunk.
See #33116.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/shortcodes.php

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

    r33359 r33594  
    436436            ),
    437437            array(
     438                '<[[gallery]]>',
     439                '<[gallery]>',
     440            ),
     441            array(
     442                '<div style="background:url([[gallery]])">',
     443                '<div style="background:url([[gallery]])">',
     444            ),
     445            array(
    438446                '[gallery]<div>Hello</div>[/gallery]',
    439447                '',
     
    472480                '<div [[gallery]]>', // Shortcodes will never be stripped inside elements.
    473481                '<div [[gallery]]>',
     482            ),
     483            array(
     484                '<[[gallery]]>',
     485                '<[[gallery]]>',
    474486            ),
    475487            array(
Note: See TracChangeset for help on using the changeset viewer.