Open awh opened 8 years ago
For future reference, the offending code:
if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
// This is a verbose page match, let's check to be sure about it.
$page = get_page_by_path( $matches[ $varmatch[1] ] );
if ( ! $page ) {
continue;
}
...
The issue is that the preg_match
expression assumes that you will only have a single match substitution, whereas our plugin composes a value for pagename
from three match variables. The subsequent code that interpolates and reparses the query should be pulled up, and the actual final value of pagename
used for this check.
The WordPress request parser (
wp-includes/class-wp.php:parse_request
) has some special case logic that attempts to analyse your rewrite rule replacement query and check whether the query will result in an accessible page. Unfortunately this logic is buggy, and so we have to defeat the analyser by inserting an arbitrary prefix before the initial$matches[]
on the right hand side ofpagename=
in our replacement query. We should upstream a fix for this bug, and remove the redundant prefix from our pagenames.