WordPress.org

Make WordPress Core

Ticket #23307: 23307.diff

File 23307.diff, 593 bytes (added by GaryJ, 15 months ago)

Immediate return of empty array if no attributes given

  • wp-includes/shortcodes.php

     
    254254 */ 
    255255function shortcode_parse_atts($text) { 
    256256        $atts = array(); 
     257        if ( ! $text ) 
     258                return $atts; 
    257259        $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; 
    258260        $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text); 
    259261        if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {