Opened 5 years ago
Last modified 5 years ago
#48524 new defect (bug)
Notice: Undefined variable: matches
Reported by: | kevinmrlw | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | 3.3 |
Component: | Query | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
<?php /wp-includes/class-wp.php in WP::parse_request at line 251
<?php // Substitute the substring matches into the query. $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches )
Change History (2)
#2
@
5 years ago
- Version changed from 5.2.4 to 3.3
Looking at WP::parse_request(), this notice is only displayed if $this->matched_rule
is set and $matches
is not.
In the conditional branches above, they are both set simultaneously, so it looks like this can only be reproduced by manually setting $wp->matched_rule
on init
or wp_loaded
action and visiting the site home page:
function wp48524_set_matched_rule() { $GLOBALS['wp']->matched_rule = 'test'; } add_action( 'init', 'wp48524_set_matched_rule' );
The code in question was added in [18466] for #17177. While we could add a check to avoid the notice, I'm still curious which plugin or code causes it, and what is the use case there.
Note: See
TracTickets for help on using
tickets.
Hi @kevinmrlw, welcome to WordPress Trac!
Could you provide the steps to reproduce the issue on a clean install? Does it still happen with all plugins disabled and a default theme (Twenty Nineteen) activated?