WordPress.org

Make WordPress Core

Changeset 33568


Ignore:
Timestamp:
08/04/2015 07:18:50 AM (6 years ago)
Author:
dd32
Message:

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

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

Location:
branches/3.7
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src

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

    r33525 r33568  
    346346        $attributes = wp_kses_attr_parse( $element );
    347347        if ( false === $attributes ) {
     348            // Some plugins are doing things like [name] <[email]>.
     349            if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
     350                $element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
     351            }
     352
    348353            // Looks like we found some crazy unfiltered HTML.  Skipping it for sanity.
    349354            $element = strtr( $element, $trans );
  • branches/3.7/tests/phpunit/tests/shortcode.php

    r33389 r33568  
    406406            ),
    407407            array(
     408                '<[[gallery]]>',
     409                '<[gallery]>',
     410            ),
     411            array(
     412                '<div style="background:url([[gallery]])">',
     413                '<div style="background:url([[gallery]])">',
     414            ),
     415            array(
    408416                '[gallery]<div>Hello</div>[/gallery]',
    409417                '',
     
    444452            ),
    445453            array(
     454                '<[[gallery]]>',
     455                '<[[gallery]]>',
     456            ),
     457            array(
    446458                '[gallery]<div>Hello</div>[/gallery]',
    447459                '',
Note: See TracChangeset for help on using the changeset viewer.