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

Sanitize meta query #3271

Merged
merged 4 commits into from
Feb 8, 2023
Merged

Sanitize meta query #3271

merged 4 commits into from
Feb 8, 2023

Conversation

MARQAS
Copy link
Contributor

@MARQAS MARQAS commented Jan 24, 2023

Description of the Change

This PR uses the WP Core sanitize_query method to sanitize the meta_query to resolve the [bool] query does not support [must] issue

Closes #3226

How to test the Change

  • Install Debug bar and Debug Bar ElasticPress
  • Enable the query logging in the EP settings.
  • Add a meta query with an integer key and see that the query does not show the error in the debug bar.
  • Example query:
new WP_Query(
		array(
			'posts_per_page' => 5,
			'no_found_rows' => true,
			'post_status' => 'publish',
			'meta_query' => array( 0 => array() ),
			'ep_integrate' => true,

		)
	);

Changelog Entry

Fixed - Sanitization of Meta Query

Credits

Props @MARQAS

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@MARQAS MARQAS added this to the 4.5.0 milestone Jan 30, 2023
@MARQAS MARQAS assigned MARQAS and unassigned MARQAS Jan 30, 2023
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MARQAS Can we please add a unit test here to be sure this bug isn't reintroduced?

@felipeelia felipeelia merged commit 2da59bb into develop Feb 8, 2023
@felipeelia felipeelia deleted the fix/3226-meta-query branch February 8, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: [bool] query does not support [must]
2 participants