WordPress.org

Make WordPress Core

Changeset 33564


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

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

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

Location:
branches/4.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1

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

    r33521 r33564  
    352352        $attributes = wp_kses_attr_parse( $element );
    353353        if ( false === $attributes ) {
     354            // Some plugins are doing things like [name] <[email]>.
     355            if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
     356                $element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
     357            }
     358
    354359            // Looks like we found some crazy unfiltered HTML.  Skipping it for sanity.
    355360            $element = strtr( $element, $trans );
  • branches/4.1/tests/phpunit/tests/shortcode.php

    r33380 r33564  
    418418            ),
    419419            array(
     420                '<[[gallery]]>',
     421                '<[gallery]>',
     422            ),
     423            array(
     424                '<div style="background:url([[gallery]])">',
     425                '<div style="background:url([[gallery]])">',
     426            ),
     427            array(
    420428                '[gallery]<div>Hello</div>[/gallery]',
    421429                '',
     
    454462                '<div [[gallery]]>', // Shortcodes will never be stripped inside elements.
    455463                '<div [[gallery]]>',
     464            ),
     465            array(
     466                '<[[gallery]]>',
     467                '<[[gallery]]>',
    456468            ),
    457469            array(
Note: See TracChangeset for help on using the changeset viewer.