Collection blueprints served from an addon directory fail with "Undefined array key 0"

Abierto
#15,880 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@joshdaugherty ya está trabajando en esto.

Desde el 13/11/2026.

  • #15881 de @joshdaugherty — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
22/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
laravel, php
Área
backend

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

blueprints & fieldsets
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
  1. Register Blueprint::addNamespace('collections.people', '/path/with/people.yaml').
  2. Call Collection::make('people')->entryBlueprints().
  3. 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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de statamic/cms

Todos los issues de statamic/cms

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.