You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing array_values() after array_diff() in VCS GitHub PR cleanup causes malformed array storage #11741
In src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php (line 237), when a pull request is closed and external contribution cleanup runs, array_diff() is used to remove the PR ID from providerPullRequestIds without wrapping in array_values().
Problem
array_diff() preserves the original numeric keys after removing elements. For example:
$ids = ['101', '102', '103'];
$result = array_diff($ids, ['102']);
// Result: [0 => '101', 2 => '103'] — gap at index 1
When this is stored in the database (JSON-encoded), PHP produces a JSON object{"0":"101","2":"103"} instead of a JSON array["101","103"]. This can cause type mismatches when the data is read back and expected to be a sequential array.
Evidence
Other parts of the codebase correctly use array_values() after array_diff():
Activity
fix: reindex array after array_diff to prevent malformed output (appw…
elijahsanders152-stack commentedon Apr 5, 2026
zaidxshaikh commentedon Apr 5, 2026
Thanks for your interest @InderjeetSingh4! I've already submitted a PR for this fix — #11742. It's currently under review.
HarshMN2345 commentedon Sep 8, 2026
fixed in #13530, closing