Make WordPress Core

Changeset 33499 for branches/4.2


Ignore:
Timestamp:
07/29/2015 08:06:56 PM (11 years ago)
Author:
azaozz
Message:

Fix do_shortcode('<[shortcode]') edge case.
Props miqrogroove. Fixes #33116 for 4.2.

Location:
branches/4.2
Files:
2 edited

Legend:

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

    r33360 r33499  
    374374                $attributes = wp_kses_attr_parse( $element );
    375375                if ( false === $attributes ) {
     376                        // Some plugins are doing things like [name] <[email]>.
     377                        if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
     378                                $element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
     379                        }
     380
    376381                        // Looks like we found some crazy unfiltered HTML.  Skipping it for sanity.
    377382                        $element = strtr( $element, $trans );
  • branches/4.2/tests/phpunit/tests/shortcode.php

    r33360 r33499  
    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.