Problem with query in loadGroupMapping using SQLite

Created on 10 March 2022, about 3 years ago
Updated 25 May 2025, 15 days ago

I thought that I was running into #3181661: Broken relations persist in graph after a group was deleted β†’ , and that may still be an issue as I couldn't recreate this in a test installation. But I'm getting a specific problem with SQLite. The query in SqlGroupGraphStorage->loadGroupMapping() gets results using fetchAll(PDO::FETCH_COLUMN|FETCH_GROUP). It turns out that this doesn't return valid results with SQLite. If the result row values are [1,2], instead of getting [1=>[2]], it gives you [0=>NULL].

This ends up causing an error in mergeMappings() when array_combine() expects an array and gets NULL instead.

Changing the queries to return a complete result and then manually building the arrays in a loop avoids the error.

The problem with SQLite is easy to demonstrate in a test script, creating and selecting from a dummy table. Is this a core bug? Is it worth rewriting the queries to avoid it anyway?

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brad.bulger

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024