[5.x]: Passing `withProvisionalDrafts` on a Matrix field throws `array_intersect()` TypeError
Maintainer thường phản hồi trong vòng 1 ngày
@brandonkelly đang làm issue này rồi.
Từ ngày 3/11/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What happened?
Description
A GraphQL selection on a Matrix field that includes the withProvisionalDrafts argument crashes in ElementQueryConditionBuilder. Matrix::getEagerLoadingGqlConditions() returns that argument as a boolean (Craft::$app->getRequest()->getIsPreview()), and the condition builder passes that boolean to array_intersect() whenever the query also supplies the argument. The query value is wrapped in an array first. The schema value is not. Both true and false throw. Omitting the argument works, because the other branch assigns the boolean as-is. Entries fields are unaffected: their eager-load conditions are arrays (sectionId, typeId). Reproduced on 5.11.5.1. The same two spots are unchanged on the current 5.x head: src/fields/Matrix.php getEagerLoadingGqlConditions() and src/gql/ElementQueryConditionBuilder.php line 475.
Steps to reproduce
- Install Craft 5.11.5.1, or use the current
5.xbranch. - Expose an entry type to GraphQL that has a Matrix field, for example
headerTitle. - Run this query against the GraphQL endpoint, with a public request so
getIsPreview()is false:
{
entry(slug: "home") {
... on home_Entry {
headerTitle(withProvisionalDrafts: true) {
__typename
}
}
}
}
- Repeat with
withProvisionalDrafts: false.
Expected behavior
The query returns the Matrix blocks. A boolean schema condition should not be passed to array_intersect(). Either apply it as a scalar, or reject the argument during GraphQL validation. Passing the argument is not required for provisional drafts: when it is omitted, Matrix already calls withProvisionalDrafts() on its nested query when getIsPreview() is true.
Actual behavior
The request fails with a GraphQL error:
array_intersect(): Argument #2 must be of type array, false given
Stack points at craft\gql\ElementQueryConditionBuilder, line 475. With withProvisionalDrafts: true on a preview request, argument #2 is true and the same TypeError is thrown.
Craft CMS version
5.11.5.1
PHP version
8.4
Operating system and version
linux
Database type and version
mysql
Image driver and version
gd
Installed plugins and versions
- Ngôn ngữ chính
- PHP
- Star
- 3.6k
- Fork
- 714
- Merge trung bình
- 13 giờ 9 phút
- Pull request đã merge (30 ngày)
- 378
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của craftcms/cms
-
bug repo:cms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
craftcms/cms#20205 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[6.x]: Element index View menu: sort direction buttons only update after the table has loadedĐang mởbug repo:cms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
craftcms/cms#20203 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[5.x]: MCP returns `[]` for CKEditor field valuesCó thể đã có người làm @i-just đã nhận 2 ngày trước. Đang mởrepo:cms
craftcms/cms#20404 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[6.x]: Entry edit page takes ~0.4s longer to first paint for every Matrix blockCó thể đã có người làm @riasvdv đã nhận 3 ngày trước. Đang mởbug repo:cms
craftcms/cms#20401 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[6.x]: Custom entry source with a single-section condition shows another source's entriesCó thể đã có người làm @brandonkelly đã nhận 3 ngày trước. Đang mởbug
craftcms/cms#20388 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
enhancement priority Sales
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
web-token/jwt-framework#757 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Include flows spanning the full report time windowCó thể đã có người làm @somethingwithproof đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Cacti/plugin_flowview#306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wintercms/wn-sitemap-plugin#31 · 2 bình luận ·