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

Fix-#3914-invalid-queries causes 500 error #370

Conversation

jaysomani
Copy link

Test Enhancement 🚀

Test Invalid API Call

Added a PHPUnit test case to ensure proper validation of an invalid API call. This test checks if the isValid method in the Documents class correctly handles the scenario where the provided queries are not an array. The expected behavior is that the method returns false and sets an error message indicating that "Queries must be an array."

Code Improvement 🛠️

Enhance isArray Method

Improved the isArray method in the same class (Documents) by fixing a parameter mismatch. The method now correctly checks if the provided value is an array using the is_array function, enhancing the reliability of the isArray function.

These changes aim to strengthen the validation logic and improve the overall robustness of the codebase.

@@ -127,7 +127,7 @@ public function isValid($value): bool
*/
public function isArray(): bool
{
return true;
return is_array($value);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is used, but it still shouldn't be changed so that it's consistent with others.

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

So, looking at the code, it looks like the Queries validator has already been updated to fix the problem so no more changes are needed.

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.

2 participants