[2.x] Audit's discussion and user filters fail on PostgreSQL

Aperta
#5,577 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@imorland ci sta già lavorando.

Dal 23/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

type/bug
Current Behavior

On PostgreSQL, filtering the audit log by discussion returns a 500:

SQLSTATE[42703]: Undefined column: 7 ERROR:  column "$.discussion_id" does not exist

extensions/audit/src/Search/Filter/DiscussionFilter.php compares json_extract(payload, "$.discussion_id"). That is MySQL's JSON syntax: PostgreSQL has no json_extract(), and it reads the double-quoted path as a column name. UserFilter.php builds json_extract(payload, "$.user_id") the same way, so the user filter should fail too (from reading the code, not reproduced).

The discussion and user audit modals open the audit browser with discussion:<id> and user:<username>, so on PostgreSQL those modals should fail to load (also from reading the code).

Steps to Reproduce
  1. Run Flarum on PostgreSQL with flarum/audit enabled.
  2. As an admin, request GET /api/audit?filter[discussion]=1.
  3. The response is a 500 with the error above.
Expected Behavior

The audit entries for that discussion (or user), as on MySQL.

Environment
  • Flarum: 2.x @ b43a84be3
  • Database: PostgreSQL 18
Possible Solution

Build the JSON path per driver, e.g. with the query grammar's JSON support (payload->discussion_id through where/whereIn on a JSON column), or payload::jsonb->>'discussion_id' on PostgreSQL.

Lingua principale
PHP
Stelle
6.8k
Fork
891
Merge medio
1g 10h
PR unite (30g)
209

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di flarum/framework

Tutte le issue di flarum/framework

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.