#64135 closed defect (bug) (fixed)
Query: undefined variable $q in WP_Query::generate_cache_key()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | 6.9 |
| Component: | Query | Keywords: | has-patch |
| Focuses: | Cc: |
Description
Follow up to https://core.trac.wordpress.org/ticket/59442
The generate_cache_key() method in WP_Query references an undefined variable $q on line 5046:
<?php if ( ! isset( $q['orderby'] ) ) { $args['orderby'] = 'date'; }
The method only has two parameters: $args and $sql. The variable $q is not defined anywhere in this method scope.
This fix is to replace the undefined $q variable with the correct $args parameter:
<?php if ( ! isset( $args['orderby'] ) ) { $args['orderby'] = 'date'; }
Change History (6)
#1
@
8 weeks ago
- Milestone changed from Awaiting Review to 6.9
- Owner set to westonruter
- Status changed from new to reviewing
This ticket was mentioned in PR #10393 on WordPress/wordpress-develop by @ramonopoly.
8 weeks ago
#2
@ramonopoly commented on PR #10393:
8 weeks ago
#3
Thanks @westonruter 🙇🏻
@ramonopoly commented on PR #10393:
8 weeks ago
#5
Committed to r61043
Note: See
TracTickets for help on using
tickets.
Follow up to: https://core.trac.wordpress.org/ticket/59442
The
generate_cache_key()method inWP_Queryreferences an undefined variable$qon line 5046:if ( ! isset( $q['orderby'] ) ) { $args['orderby'] = 'date'; }The method only has two parameters:
$argsand$sql. The variable$qis not defined anywhere in this method scope.Introduced in https://core.trac.wordpress.org/changeset/58122 / https://github.com/10up/wordpress-develop/commit/3a6cca9ff772c77c86a3cf7c5a69398acc4c2272
This patch replaces the undefined
$qvariable with the correct$argsparameter:if ( ! isset( $args['orderby'] ) ) { $args['orderby'] = 'date'; }