Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal if $query->get( 'order' ) is an array #190

Open
kingkool68 opened this issue Oct 16, 2024 · 1 comment
Open

PHP Fatal if $query->get( 'order' ) is an array #190

kingkool68 opened this issue Oct 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kingkool68
Copy link

Description of the bug

In

// Set sort ordering.
$order = strtolower( $query->get( 'order' ) );
if ( ! empty( $order ) ) {
if ( in_array( $order, [ 'asc', 'desc' ], true ) ) {
$es_wp_query_args['order'] = $order;
}
}
the order value of the query gets passed directly to strtolower(). It's possible for the order parameter of WP_Query to be an array and SearchPress currently can't handle that.

Steps To Reproduce

Run query like this:

$query = new WP_Query([
	'orderby' => [ 'title', 'date' ],
	'order'     => [ 'DESC', 'ASC' ],
]);

Additional Information

No response

@kingkool68 kingkool68 added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@kingkool68 and others