[wp-trac] [WordPress Trac] #23587: url_to_postid() needs to use # or @ for preg_match start/end character
WordPress Trac
noreply at wordpress.org
Fri Jan 31 09:49:03 UTC 2014
#23587: url_to_postid() needs to use # or @ for preg_match start/end character
---------------------------+-----------------------------
Reporter: coreygilmore | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Rewrite Rules | Version: 1.5.2
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
---------------------------+-----------------------------
Comment (by Denis-de-Bernardy):
Replying to [comment:5 nacin]:
> #26970 was marked as a duplicate.
Replying here
the `#` delimiter doesn't break anything. It's used in wp-includes/class-
wp.php, in the parse_request() function:
{{{
foreach ( (array) $rewrite as $match => $query ) {
// If the requesting file is the anchor of the match, prepend it
to the path info.
if ( ! empty($req_uri) && strpos($match, $req_uri) === 0 &&
$req_uri != $request )
$request_match = $req_uri . '/' . $request;
if ( preg_match("#^$match#", $request_match, $matches) ||
preg_match("#^$match#", urldecode($request_match),
$matches) ) {
if ( $wp_rewrite->use_verbose_page_rules && preg_match(
'/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
// this is a verbose page match, lets check to be
sure about it
if ( ! get_page_by_path( $matches[ $varmatch[1] ]
) )
continue;
}
// Got a match.
$this->matched_rule = $match;
break;
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/23587#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list