diff --git src/wp-includes/shortcodes.php src/wp-includes/shortcodes.php
index 9874785..1416024 100644
|
|
function do_shortcode_tag( $m ) { |
306 | 306 | * @return array List of attributes and their value. |
307 | 307 | */ |
308 | 308 | function shortcode_parse_atts($text) { |
| 309 | if ( empty( trim( $text ) ) ) { |
| 310 | return array(); |
| 311 | } |
309 | 312 | $atts = array(); |
310 | 313 | $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; |
311 | 314 | $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text); |
… |
… |
function shortcode_parse_atts($text) { |
323 | 326 | $atts[] = stripcslashes($m[8]); |
324 | 327 | } |
325 | 328 | } else { |
326 | | $atts = ltrim($text); |
| 329 | $atts[] = ltrim( $text ); |
327 | 330 | } |
328 | 331 | return $atts; |
329 | 332 | } |
diff --git tests/phpunit/tests/shortcode.php tests/phpunit/tests/shortcode.php
index 7e8b971..5273eea 100644
|
|
class Tests_Shortcode extends WP_UnitTestCase { |
75 | 75 | |
76 | 76 | function test_noatts() { |
77 | 77 | do_shortcode('[test-shortcode-tag /]'); |
78 | | $this->assertEquals( '', $this->atts ); |
| 78 | $this->assertEmpty( $this->atts ); |
79 | 79 | $this->assertEquals( 'test-shortcode-tag', $this->tagname ); |
80 | 80 | } |
81 | 81 | |
… |
… |
class Tests_Shortcode extends WP_UnitTestCase { |
127 | 127 | |
128 | 128 | function test_noatts_enclosing() { |
129 | 129 | do_shortcode('[test-shortcode-tag]content[/test-shortcode-tag]'); |
130 | | $this->assertEquals( '', $this->atts ); |
| 130 | $this->assertEmpty( $this->atts ); |
131 | 131 | $this->assertEquals( 'content', $this->content ); |
132 | 132 | $this->assertEquals( 'test-shortcode-tag', $this->tagname ); |
133 | 133 | } |
… |
… |
class Tests_Shortcode extends WP_UnitTestCase { |
149 | 149 | function test_unclosed() { |
150 | 150 | $out = do_shortcode('[test-shortcode-tag]'); |
151 | 151 | $this->assertEquals( '', $out ); |
152 | | $this->assertEquals( '', $this->atts ); |
| 152 | $this->assertEmpty( $this->atts ); |
153 | 153 | $this->assertEquals( 'test-shortcode-tag', $this->tagname ); |
154 | 154 | } |
155 | 155 | |