[wp-trac] [WordPress Trac] #23307: shortcode_parse_atts may return empty string

WordPress Trac noreply at wordpress.org
Sat Nov 8 20:05:45 UTC 2014


#23307: shortcode_parse_atts may return empty string
-----------------------------------+-----------------------------
 Reporter:  GaryJ                  |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Future Release
Component:  Shortcodes             |     Version:
 Severity:  minor                  |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+-----------------------------
Changes (by aaroncampbell):

 * keywords:  needs-unit-tests needs-patch => has-patch 2nd-opinion


Comment:

 My thoughts:
 1) I agree that it makes more sense to return an empty array for no
 attributes.
 2) Most people are probably using `empty( $atts )` but there might be some
 places where we break people's tests for empty attributes. I'm thinking
 this is a pretty minor breakage.
 3) One thing we ARE breaking are our own unit tests. We check for `''`. My
 patches switch our tests from `assertEquals( '', $atts )` to `assertEmpty(
 $atts )` instead.
 4) And lastly, the most important thing, I can't seem to trigger the else
 in `shortcode_parse_atts()`. My first patch ([attachment:23307.2.diff])
 returns an array in that case, but I couldn't come up with any content to
 test it with. My second patch ([attachment:23307.3.diff]) removes the else
 entirely. All unit tests still pass.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23307#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list