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 bug where Query parser ignored 0 strings #194

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

stnguyen90
Copy link
Contributor

@stnguyen90 stnguyen90 commented Sep 23, 2022

When Query::parse() parsed a string like equal("attr", [0]) it ignored the 0 string so the values was an empty array. This caused a 500 error in Appwrite.

appwrite  | array(1) {
appwrite  |   [0]=>
appwrite  |   object(Utopia\Database\Query)#1556 (3) {
appwrite  |     ["method":protected]=>
appwrite  |     string(5) "equal"
appwrite  |     ["attribute":protected]=>
appwrite  |     string(7) "intAttr"
appwrite  |     ["values":protected]=>
appwrite  |     array(0) {
appwrite  |     }
appwrite  |   }
appwrite  | }
appwrite  | [Error] Type: Utopia\Exception
appwrite  | [Error] Message: Error handler had an error
appwrite  | [Error] File: /usr/src/code/vendor/utopia-php/framework/src/App.php

Related issue:

Copy link
Member

@eldadfux eldadfux left a comment

Choose a reason for hiding this comment

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

Looks good, left one small comment. 👍

@@ -251,7 +251,9 @@ public static function parse(string $filter): self
} else {
// Append from parap builder. Either value, or array
if (empty($currentArrayParam)) {
if (!empty($currentParam)) {
// if (!empty($currentParam)) {
Copy link
Member

Choose a reason for hiding this comment

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

leftover

@eldadfux eldadfux mentioned this pull request Sep 24, 2022
1 task
@stnguyen90 stnguyen90 force-pushed the fix-zero-value-in-array-query branch from 7b8d5ff to c75fc11 Compare September 26, 2022 19:27
@stnguyen90 stnguyen90 requested a review from eldadfux September 26, 2022 19:27
@stnguyen90 stnguyen90 changed the title Fix bugs where Query parser ignored 0 strings Fix bug where Query parser ignored 0 strings Sep 27, 2022
@stnguyen90 stnguyen90 force-pushed the fix-zero-value-in-array-query branch from c75fc11 to 4e34926 Compare September 30, 2022 15:00
@stnguyen90 stnguyen90 force-pushed the fix-zero-value-in-array-query branch from 4e34926 to 6d1c1d4 Compare September 30, 2022 15:01
@christyjacob4 christyjacob4 merged commit d172af2 into main Oct 3, 2022
@stnguyen90 stnguyen90 deleted the fix-zero-value-in-array-query branch October 3, 2022 17:22
@TorstenDittmann TorstenDittmann restored the fix-zero-value-in-array-query branch October 4, 2022 08:33
@stnguyen90 stnguyen90 deleted the fix-zero-value-in-array-query branch March 23, 2023 23:54
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.

3 participants