Make WordPress Core

Ticket #35022: 35022.patch

File 35022.patch, 1.6 KB (added by steevithak, 9 years ago)

Fix parsing of shortcodes that contain Unicode non-breaking spaces or Unicode quotes

  • trunk/wp-includes/shortcodes.php

     
    9595                return;
    9696        }
    9797
    98         if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
     98        if ( 0 !== preg_match( '@[<>&/\[\]\s=]@u', $tag ) ) {
    9999                /* translators: 1: shortcode name, 2: space separated list of reserved characters */
    100100                $message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' );
    101101                _doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
     
    210210                return $content;
    211211
    212212        // Find all registered tag names in $content.
    213         preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
     213        preg_match_all( '@\[([^<>&/\[\]\s=]++)@u', $content, $matches );
    214214        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
    215215
    216216        if ( empty( $tagnames ) ) {
     
    481481function shortcode_parse_atts($text) {
    482482        $atts = array();
    483483        $pattern = get_shortcode_atts_regex();
     484        $text = preg_replace('/&#8221;|&#8243;/i',"\x22",$text);
    484485        $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
    485486        if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {
    486487                foreach ($match as $m) {
     
    578579                return $content;
    579580
    580581        // Find all registered tag names in $content.
    581         preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
     582        preg_match_all( '@\[([^<>&/\[\]\s=]++)@u', $content, $matches );
    582583        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
    583584
    584585        if ( empty( $tagnames ) ) {