[wp-trac] [WordPress Trac] #34939: Shortcode regex no longer matches [shortcode=XXX]
WordPress Trac
noreply at wordpress.org
Thu Dec 17 03:30:59 UTC 2015
#34939: Shortcode regex no longer matches [shortcode=XXX]
--------------------------+--------------------
Reporter: kraftbj | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4.1
Component: Shortcodes | Version: 4.4
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+--------------------
Comment (by dd32):
This is a fun issue..
Has `[shortcode=var]` ever actually been documented as a "thing"? What
about `[shortcode/var]`? or even `[shortcode!var]`? both of which
previously worked. (I'm mostly wondering where that syntax came from
originally, I suspect it was accidental and "just worked" with the lazy
parser we had)
`[shortcode/var]` works in 4.4 still, mostly by accident AFAICT
What this is caused by is this bit of code in `do_shortcode()` which
detects what shortcodes are in the content:
{{{
// Find all registered tag names in $content.
preg_match_all( '@\[([^<>&/\[\]\x00-\x20]++)@', $content, $matches );
}}}
That causes `[shortcode=foo` to be recognised as `shortcode=foo` being the
shortcode name, but `[shortcode&foo`, `[shortcode/foo`, or `[shortcode
foo` is understood to only be `shortcode`.
Pinging @miqrogroove can you step in here and clarify what the expected
case is here? Should `=` be a reserved character that can't be contained
in a shortcode name too? are there others that should potentially be added
too? All punctuation?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34939#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list