WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 21 months ago

#47863 reopened defect (bug)

Fix odd, unexpected output from shortcode_parse_attts — at Version 1

Reported by: mauteri Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Shortcodes Keywords: has-patch has-unit-tests dev-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

When passing a full shortcode to this function, I'm expecting only an array of key/value attributes of the shortcode to be returned, however this is not the case. Basic example (though my diff of unit tests have many), this shortcode:

[unittest title="unittest" link="https://unit.test/"]

will return an array that looks like this:

(
    0 => '[unittest'
    'title' => 'unittest'
    1 => 'link="https://unit.test/"]'
)

rather than one that looks like this

(
    'title' => 'unittest'
    'link' => 'https://unit.test/'
)

I've already created a patch for this. I will put it in two parts. First unit tests with a data provider of 6 unit test format examples. 5 out of 6 will fail. I will then include another patch that includes the unit tests plus the proposed fix to the function.

Change History (3)

@mauteri
2 years ago

This patch is of failing unit tests

@mauteri
2 years ago

Patch for issue plus unit tests

#1 @SergeyBiryukov
2 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.