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

Đang mở
#5,577 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@imorland đang làm issue này rồi.

Từ ngày 23/11/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
6.8k
Fork
891
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
209

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flarum/framework

Tất cả issue của flarum/framework

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.