[5.x]: Passing `withProvisionalDrafts` on a Matrix field throws `array_intersect()` TypeError
I maintainer di solito rispondono entro 1 giorno
@brandonkelly ci sta già lavorando.
Dal 3/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- PHP
- Stelle
- 3.6k
- Fork
- 712
- Merge medio
- 13h 8m
- PR unite (30g)
- 366
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di craftcms/cms
-
bug repo:cms
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
craftcms/cms#20205 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[6.x]: Element index View menu: sort direction buttons only update after the table has loadedApertabug repo:cms
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
craftcms/cms#20203 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[5.x] MCP: `configuration.update` fails for Matrix fields with TypeError on `$propagationMethod`Apertabug repo:cms
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
craftcms/cms#20406 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
repo:cms
Difficoltà 3/5 1-2 giorni Idoneità per principianti 73/100
craftcms/cms#20405 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[5.x]: MCP returns `[]` for CKEditor field valuesForse già presa @i-just l’ha presa oggi. Apertarepo:cms
craftcms/cms#20404 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di craftcms/cms
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
FriendsOfFlarum/synopsis#16 ·
-
bug javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
simplesamlphp/simplesamlphp#2693 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
FinanceFlash/unvibecode#577 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno