Skip to content

Conversation

@abnegate
Copy link
Member

E.g. Currently:

$queries = [Query::equal('$id', ['123']];
$filters = Query::groupByType()['filters'];

// Changing the attribute of the query in the original array
$queries[0]->setAttribute('_uid');

// Will change the attribute of the query returned by the `groupByType` method, which is unexpected
$filters[0]->getAttribute() === '_uid'

This is an issue from Appwrite because we mutate query attributes in the find function and then pass the same query references to the count function, which means the values are already mutated. Cloning the queries fixes the issue because changes to one array will not affect the other.

@abnegate abnegate requested a review from stnguyen90 August 21, 2023 23:11
@abnegate abnegate merged commit e5353ea into main Aug 21, 2023
@abnegate abnegate deleted the fix-query-references branch November 23, 2023 01: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