[wp-trac] [WordPress Trac] #59249: shortcode_parse_atts() result for no attributes does not match the documentation

WordPress Trac noreply at wordpress.org
Wed Aug 30 11:19:22 UTC 2023


#59249: shortcode_parse_atts() result for no attributes does not match the
documentation
----------------------------+-------------------------
 Reporter:  SergeyBiryukov  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  6.4
Component:  Shortcodes      |    Version:
 Severity:  normal          |   Keywords:  2nd-opinion
  Focuses:                  |
----------------------------+-------------------------
 Background: #59206.

 The `shortcode_parse_atts()` documentation says:
 {{{
  * @return array|string Array of attribute values keyed by attribute name.
  *                      Returns empty array if there are no attributes.
  *                      Returns the original arguments string if it cannot
 be parsed.
 }}}

 The middle part (empty array if there are no attributes) appears to be
 incorrect. In my testing, the function returns an empty string in that
 case.

 Do we want to update the results to match the documentation, or just
 correct the documentation?

 Some history:
 * [6659] introduced the `shortcode_parse_atts()` function.
 * [8196] / #7184 added the initial documentation.
 * [34744] / #23307 expanded it for empty values.
 * [55711] / #57840 adjusted it to the current wording.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59249>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list