WordPress.org

Make WordPress Core

Ticket #23587: miqro-23587.2.patch

File miqro-23587.2.patch, 897 bytes (added by miqrogroove, 4 years ago)

Extra paranoid version.

  • src/wp-includes/rewrite.php

     
    362362                if ( !empty($url) && ($url != $request) && (strpos($match, $url) === 0) )
    363363                        $request_match = $url . '/' . $request;
    364364
    365                 if ( preg_match("!^$match!", $request_match, $matches) ) {
     365                $pattern = preg_replace( '/(?<=^|[^\\\\])((?:\\\\\\\\)*)@/', '$1\@', $match ); // Slash any @ not preceded by an odd number of slashes.
     366                $pattern = '@^' . $pattern . '@';
    366367
     368                if ( preg_match($pattern, $request_match, $matches) ) {
     369
    367370                        if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
    368371                                // this is a verbose page match, lets check to be sure about it
    369372                                if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) )