[5.x]: Passing `withProvisionalDrafts` on a Matrix field throws `array_intersect()` TypeError
Los mantenedores suelen responder en 1 día
@brandonkelly ya está trabajando en esto.
Desde el 3/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- PHP
- Estrellas
- 3.6k
- Forks
- 712
- Merge medio
- 12 h 44 min
- PR fusionados (30 d)
- 381
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de craftcms/cms
-
bug repo:cms
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
craftcms/cms#20205 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[6.x]: Element index View menu: sort direction buttons only update after the table has loadedAbiertobug repo:cms
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
craftcms/cms#20203 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[5.x]: Moving an asset with “Replace it” throws TypeError: volumeUid must be of type string, null givenPosiblemente ocupada @i-just la tomó hace 8 días. Abiertobug repo:cms
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
craftcms/cms#20128 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
bug repo:cms
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
craftcms/cms#20386 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
repo:cms
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
craftcms/cms#20385 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de craftcms/cms
Issues similares
-
bug ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
hashtopolis/server#2614 ·
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Перевод устарел
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
-
bug-report bug-report-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
Codeinwp/wp-maintenance-mode#596 · 1 comentario ·
Los mantenedores suelen responder en 1 día