[wp-trac] [WordPress Trac] #18991: Unnecessarily cryptic code when checking pagename= for verbose rules
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 18 20:42:02 UTC 2011
#18991: Unnecessarily cryptic code when checking pagename= for verbose rules
--------------------------+-----------------------
Reporter: duck_ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.3
Component: General | Version: 3.3
Severity: normal | Keywords: has-patch
--------------------------+-----------------------
[18541] for #16687 contains:
{{{
if ( $wp_rewrite->use_verbose_page_rules && preg_match(
'/pagename=\$([^&\[]+)\[([0-9]+)\]/', $query, $varmatch ) ) {
// this is a verbose page match, lets check to be sure about it
if ( ! get_page_by_path( ${$varmatch[1]}[$varmatch[2]] ) )
}}}
The variable variable is unnecessary as we know we want to be looking in
the $matches array.
The regular expression could also be made clearer with
`/pagename=\$matches\[([0-9]+)\]/`. We already assume it is (see above)
and if it's not $matches then WP_MatchesMapMatches isn't going to work
anyway.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18991>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list