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

Offen
#15,880 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@joshdaugherty arbeitet bereits daran.

Seit 13.11.2026.

  • #15881 von @joshdaugherty — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
Ein halber Tag
Anfängerfreundlichkeit
22/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
laravel, php
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
PHP
Sterne
4.9k
Forks
647
Ø Merge
1 T. 45 Min.
Gemergte PRs (30 T.)
221

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus statamic/cms

Alle Issues in statamic/cms

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.