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

Abierto
#5,577 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@imorland ya está trabajando en esto.

Desde el 23/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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.

Lenguaje dominante
PHP
Estrellas
6.8k
Forks
891
Merge medio
1 d 10 h
PR fusionados (30 d)
209

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de flarum/framework

Todos los issues de flarum/framework

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.