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

Aperta
#15,880 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@joshdaugherty ci sta già lavorando.

Dal 13/11/2026.

  • #15881 di @joshdaugherty — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
laravel, php
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
PHP
Stelle
4.9k
Fork
647
Merge medio
1g 45m
PR unite (30g)
221

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di statamic/cms

Tutte le issue di statamic/cms

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.