[wp-trac] [WordPress Trac] #47863: Fix odd, unexpected output from shortcode_parse_attts
WordPress Trac
noreply at wordpress.org
Tue Aug 13 20:27:22 UTC 2019
#47863: Fix odd, unexpected output from shortcode_parse_attts
--------------------------------------+-----------------------------
Reporter: mauteri | Owner: SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 5.3
Component: Shortcodes | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Comment (by birgire):
I wonder if we could simplify with e.g.:
{{{
if ( preg_match( '#^\[[\w-]+([^\]]*?)\/?\]#', $text, $matches ) ) {
$text = $matches[1];
}
}}}
i.e. use non-greedy {{{*?}}} check to allow for the latter {{{\/?}}}
check.
This seems to run the tests successfully.
ps: here's though another kind of edge case:
{{{
array(
'[unittest link=https://unit.test/]Lorem Ipsum[/unittest]',
array(
'link' => 'https://unit.test/',
),
),
}}}
that will not pass.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47863#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list