Collection blueprints served from an addon directory fail with "Undefined array key 0"
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 22/100
Línea de trabajo
Start in BlueprintRepository.php at makeBlueprintFromFile(), and compare its $additionalNamespaces lookup with how filesIn() normalizes collections/people to collections.people. Follow Collection::entryBlueprints() to see the call path. Work on this is already under way in PR #15881, so check that PR before starting. Done means a regression test for an addon-registered collection blueprint directory passes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug description
An addon that registers a collection blueprint directory with Blueprint::addNamespace('collections.people', $dir) (what AddonServiceProvider does with $blueprintNamespace) cannot have that collection's entry blueprints loaded.
Collection::entryBlueprints() calls Blueprint::in('collections/people'). filesIn() normalizes / to . and finds the addon directory, but then makeBlueprintFromFile($file, 'collections/people') looks the slash form up in $additionalNamespaces (keyed with dots), misses, and falls through to getNamespaceAndHandleFromPath() for a path outside every configured directory: ErrorException: Undefined array key 0 at BlueprintRepository.php:362 (6.40.0).
Expected: the blueprint loads, as it does through filesIn().
How to reproduce
- Register
Blueprint::addNamespace('collections.people', '/path/with/people.yaml'). - Call
Collection::make('people')->entryBlueprints(). - Observe
ErrorException: Undefined array key 0.
Reproduced on 6.40.0 and on current 6.x (9d20aef).
Logs
ErrorException: Undefined array key 0 at BlueprintRepository.php:362
Environment
Statamic: 6.40.0 (also current 6.x, 9d20aef)
Found by reading the package source and reproducing it in the package's own test suite, not on a running site, so the full php please support:details output is not available.
Installation
Other (please explain): reproduced in the statamic/cms test suite, with an addon-style namespace registration.
Additional details
Fix: normalize the namespace in makeBlueprintFromFile() the same way filesIn() does. A pull request with a regression test follows.
- Lenguaje dominante
- PHP
- Estrellas
- 4.9k
- Forks
- 647
- Merge medio
- 1 d 45 min
- PR fusionados (30 d)
- 221
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 statamic/cms
-
forms ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
accessibility
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
antlers
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pagePosiblemente ocupada @duncanmcclean la tomó hoy. Abiertonavigations
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itPosiblemente ocupada @duncanmcclean la tomó hoy. Abiertoforms
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de statamic/cms
Issues similares
-
sync-en
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Selection on a line without a docblock tag drops trailing characters (data provider attribute)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vimeo/psalm#15150 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
taskforcesh/bullmq#5238 ·
Los mantenedores suelen responder en 1 día
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itPosiblemente ocupada @bfs2021 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Automattic/jetpack#55517 ·
Los mantenedores suelen responder en 1 día